To find whether a number is even or odd without using any
conditional operator??

Answers were Sorted based on User's Feedback



To find whether a number is even or odd without using any conditional operator??..

Answer / kala

main()
{
int n;
printf("enter the number\n");
scanf("%d",&n);
if(n%2==0){
printf("number is even");}
else{
printf("number is odd");
}
}
or
if(n&1==0)
printf("even number");
else
printf(odd number");

Is This Answer Correct ?    31 Yes 38 No

To find whether a number is even or odd without using any conditional operator??..

Answer / sahithya

void main()
{
int n;
printf("enter n:");
scanf("%d",&n);
if(n%2==0)
printf( "even");
else
printf("odd");
}

Is This Answer Correct ?    15 Yes 34 No

Post New Answer

More C Interview Questions

Can we initialize extern variable in c?

0 Answers  


Describe how arrays can be passed to a user defined function

0 Answers  


How can I get back to the interactive keyboard if stdin is redirected?

0 Answers  


Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1

0 Answers  


what is the difference between procedure oriented and object oriented progaming language

1 Answers  


what is the hardware model of CFG( context free grammar)

0 Answers   Microsoft,


Write a program that can show the multiplication table.

0 Answers   Student,


write a programe returns the number of times the character appears in the string

2 Answers  


What is assert and when would I use it?

0 Answers  


how is the examination pattern?

0 Answers   Wipro,


write a program to display numbers from 1 to 10 and 10 to 1?

2 Answers  


Explain how do you convert strings to numbers in c?

0 Answers  


Categories