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


Please Help Members By Posting Answers For Below Questions

Hi can anyone tell what is a start up code?

1616


What are logical errors and how does it differ from syntax errors?

661


Why cant I open a file by its explicit path?

593


Explain data types & how many data types supported by c?

586


What is calloc() function?

625






What does the && operator do in a program code?

698


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4179


ATM machine and railway reservation class/object diagram

4805


swap 2 numbers without using third variable?

662


What is the mean of function?

649


Explain what header files do I need in order to define the standard library functions I use?

649


What does sizeof function do?

613


Explain how can I convert a number to a string?

650


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

3843


The difference between printf and fprintf is ?

720