find a number whether it is even or odd without using any
control structures and relational operators?
Answer Posted / gganesh
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter the number : ");
scanf("%d",&n);
n%2?printf("Odd"):printf("Even");
getch();
}
note: here i used conditional operator, not a relational
operators and control structures
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What are c header files?
What are the types of data types and explain?
What is c definition?
Why enum is used in c?
What is multidimensional arrays
What is keyword in c?
What is an example of structure?
Explain the use of fflush() function?
What does %c mean in c?
What are identifiers in c?
Why can’t we compare structures?
Differentiate between the expression “++a” and “a++”?
What is the advantage of using #define to declare a constant?
What is the size of structure in c?
Do character constants represent numerical values?