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

Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

0 Answers  


write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.

0 Answers  


How can I make sure that my program is the only one accessing a file?

0 Answers  


what is mallloc()?how it works?

4 Answers   Excel,


Go through the following code sinippet char a[20]; a="Hello Orcale Test"; will this compile?

4 Answers   Oracle,






in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

0 Answers   TCS,


What is the difference between far and near ?

0 Answers  


What will be your course of action for a push operation?

0 Answers  


What are bitwise shift operators in c programming?

0 Answers  


What are the back slash character constants or escape sequence charactersavailable in c?

0 Answers  


how to make c program without a libary? e.g.#include<stdio.h> libary is not in c progaram.

2 Answers  


Is Exception handling possible in c language?

0 Answers   Wipro,


Categories