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
To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
What is the full form of getch?
What should malloc(0) do?
What does != Mean in c?
what is the significance of static storage class specifier?
Explain how do you determine a file’s attributes?
Write a program to identify if a given binary tree is balanced or not.
What is const volatile variable in c?
What is a union?
Explain how do you convert strings to numbers in c?
How can I sort more data than will fit in memory?
What is scanf () in c?
What is the use of sizeof () in c?