find a number whether it is even or odd without using any
control structures and relational operators?
Answer Posted / sanju uthaiah
#include<stdio.h>
int main()
{
char result[2]={"Even","Odd"};
int n=40;
printf("%d is %s",n,result[n%2]);
return 0;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Hi can anyone tell what is a start up code?
What are logical errors and how does it differ from syntax errors?
Why cant I open a file by its explicit path?
Explain data types & how many data types supported by c?
What is calloc() function?
What does the && operator do in a program code?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
ATM machine and railway reservation class/object diagram
swap 2 numbers without using third variable?
What is the mean of function?
Explain what header files do I need in order to define the standard library functions I use?
What does sizeof function do?
Explain how can I convert a number to a string?
Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer
The difference between printf and fprintf is ?