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
Which is better oop or procedural?
Why clrscr is used in c?
What is floating point constants?
Explain what is page thrashing?
Where is c used?
What is scope and lifetime of a variable in c?
Write a program for finding factorial of a number.
Write programs for String Reversal & Palindrome check
What is storage class?
How do I get a null pointer in my programs?
How can I change the size of the dynamically allocated array?
What is far pointer in c?
Which one would you prefer - a macro or a function?
How will you divide two numbers in a MACRO?
What does != Mean in c?