write a c program to print a given number as odd or even
without using loop statements,(no if ,while etc)
Answer Posted / bhabesh rai
#include<stdio.h>
main()
{
int n;
printf("Enter an integer:\n");
scanf("%d", &n);
switch((n%2 == 0) ? (1) : (2))
{
case 1:
printf("EVEN\n", n);
break;
case 2:
printf("ODD\n", n);
break;
}
}
| Is This Answer Correct ? | 2 Yes | 3 No |
Post New Answer View All Answers
How can I avoid the abort, retry, fail messages?
What is function in c with example?
What is the best way to store flag values in a program?
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
What is #include stdio h and #include conio h?
What does != Mean in c?
When should the register modifier be used? Does it really help?
What is clrscr in c?
Lists the benefits of c programming language?
Write a program that accept anumber in words
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
differentiate built-in functions and user – defined functions.
What is array within structure?
Explain the use of bit fieild.
What are predefined functions in c?