Write a programme to find even numbers without using any
conditional statement?

Answers were Sorted based on User's Feedback



Write a programme to find even numbers without using any conditional statement?..

Answer / mathiyazhagan

#include<stdio.h>
main()
{
char res[2][5]={"Even","Odd"};
int n;
printf("Enter a number :");
scanf("%d",&n);
printf("the given no is = %s",res[n%2]);
}

Is This Answer Correct ?    51 Yes 7 No

Write a programme to find even numbers without using any conditional statement?..

Answer / sridhar

#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,d; /*declaring variable using int*/
clrscr();
printf("enter the numbers:")
scanf("/n%d/n%d",&a,&b);/*getting number using scanf*/
c=a,b;
d=(c/2==0);
printf("the even number is:%d",d)/*print the final answer*/
getch();
}

Is This Answer Correct ?    8 Yes 25 No

Write a programme to find even numbers without using any conditional statement?..

Answer / guest

#nclude<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("\n Enter the numbers for a,b,c:");
scanf("%d%d",&a,&b);
c=a/b;
c=0;
printf("The given number is even");
getch();
}

Is This Answer Correct ?    6 Yes 57 No

Post New Answer

More C Interview Questions

Explain how can I open a file so that other programs can update it at the same time?

0 Answers  


write C code to reverse a string such that if i/p is "abc defg hij klmno pqrs tuv wxyz" and the o/p should be "cba gfed jih onmlk srqp vut zyxw"

2 Answers  


How to declare pointer variables?

0 Answers  


What is #line?

0 Answers  


what is the difference between auto and static keywords

1 Answers   cDot, College School Exams Tests, TCS,


What is the difference between declaring a variable by constant keyword and #define ing that variable?

1 Answers  


What is the maximum length of an identifier?

0 Answers  


what are non standard function in c

0 Answers  


Explain indirection?

0 Answers  


What is structure padding and packing in c?

0 Answers  


List the variables are used for writing doubly linked list program.

0 Answers   Infosys, Wipro,


What will be the output of the following program #include<stdio.h> void main() { int i=20; i-=i+++++i++; printf("%d",i); }

5 Answers  


Categories