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
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
Explain why c is faster than c++?
Explain what is the stack?
What is difference between Structure and Unions?
how to introdu5ce my self in serco
What are the two types of functions in c?
Explain how to reverse singly link list.
What is .obj file in c?
What is pragma in c?
Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.
Is there any demerits of using pointer?
What are the complete rules for header file searching?
What is the difference between union and structure in c?
What is property type c?
How can I open files mentioned on the command line, and parse option flags?