Write a program to find given number is even or odd without
using any control statement.

Answers were Sorted based on User's Feedback



Write a program to find given number is even or odd without using any control statement...

Answer / rani

#include<stdio.h>
#include<conio.h>
void main()
{
char str[][10]={"even","odd"};
int no;
clrscr();
printf("\nEnter a number...");
scanf("%d",&no);
printf("\n%d is %s",no,str[no%2]);
getch();
}

Is This Answer Correct ?    13 Yes 1 No

Write a program to find given number is even or odd without using any control statement...

Answer / saneemask

main()
{

{
char a[][5]= {"Even","Odd"};
int n;
printf("Enter any no.: ");
scanf("%d",&n);
printf("%s",a[n%2]);
getch();
}
{

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C Interview Questions

explain what are pointers?

0 Answers  


#include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); } what is the output for this?

4 Answers   IIIT,


is it possible to create your own header files?

0 Answers  


What are Storage Classes in C ?

32 Answers   CTS, HP, IBM, Maharaja Whiteline, Tamil Nadu Open University TNOU, TATA, TCS, Wipro,


can we write a program in c for printf and scanf without using header file stdio.h

1 Answers  


What is the use of linkage in c language?

0 Answers  


What does the c preprocessor do?

0 Answers  


what is difference between getchar,putchar functions and printf and scanf function? does putchar show output only when input given to it

5 Answers   DIT,


How can I make a program in c to print 'Hello' without using semicolon in the code?

9 Answers   C DAC, Practical Viva Questions,


Not all reserved words are written in lowercase. TRUE or FALSE?

0 Answers  


What are c identifiers?

0 Answers  


Differentiate b/w Modify and Update commands giving example.

1 Answers  


Categories