write a c program to print a given number as odd or even
without using loop statements,(no if ,while etc)
Answer Posted / p.thirugnanavel
#include<stdio.h>
#include<conio.h>
void main()
{
int no,ch;
clrscr();
printf("enter the number :");
scanf("%d",&no);
ch=(no%2==0) ? (1) : (2);
switch(ch)
{
case 1:
printf("The number %d is even",no);
break;
case 2:
printf("The number %d is odd",no);
break;
}
getch();
}
Is This Answer Correct ? | 7 Yes | 5 No |
Post New Answer View All Answers
Explain why C language is procedural?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
What do you mean by Recursion Function?
What are structure members?
What is variable in c example?
What is ## preprocessor operator in c?
Why do we use c for the speed of light?
Explain how can I manipulate strings of multibyte characters?
What is c variable?
Can we initialize extern variable in c?
What is the difference between near, far and huge pointers?
Implement bit Array in C.
What is a good data structure to use for storing lines of text?
Describe explain how arrays can be passed to a user defined function