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
What will be your course of action for a push operation?
What’s the special use of UNIONS?
What is union in c?
What is header file definition?
Can we use visual studio for c?
What is wild pointer in c with example?
What is the importance of c in your views?
how is the examination pattern?
What does a function declared as pascal do differently?
Explain 'bus error'?
Explain the process of converting a Tree into a Binary Tree.
What is the use of typedef in c?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
Explain what is the difference between far and near ?
Explain what are the standard predefined macros?