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
What is LINKED LIST? How can you access the last element in a linked list?
Is null equal to 0 in sql?
Explain how can I convert a string to a number?
what is ur strangth & weekness
what are the 10 different models of writing an addition program in C language?
How can you increase the size of a statically allocated array?
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
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
Why doesnt this code work?
What is the use of a static variable in c?
Why c language?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
Write a program to reverse a given number in c?
What is quick sort in c?
What are the restrictions of a modulus operator?