How to find the given no is odd or even without checking of
any condition and loops. (Hint: Using array)
Answer Posted / vaishu
void main()
{
int n;
char s[]={"even","odd"};
printf("Enter the no.:");
scanf("%d",&n);
n=n%2;
printf("th no. is %s",s[n]);
getch();
}
| Is This Answer Correct ? | 12 Yes | 7 No |
Post New Answer View All Answers
program to convert a integer to string in c language'
how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions
Why #include is used in c language?
What is the difference between union and structure in c?
What is the data segment that is followed by c?
When would you use a pointer to a function?
how many key words availabel in c a) 28 b) 31 c) 32
Is c procedural or object oriented?
What are logical errors and how does it differ from syntax errors?
What does printf does?
What is sizeof int?
What is the sizeof () operator?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
What does typeof return in c?
What is the difference between new and malloc functions?