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

#define MAX 3 main() { printf("MAX = %d ",MAX ); #undef MAX #ifdef MAX printf("Vector Institute”); #endif }

1 Answers  


Write a program to print ASCII code for a given digit.

0 Answers   EXL, HCL,


how to find out the inorder successor of a node in a tree??

2 Answers   TCS, Yahoo,


in linking some of os executables are linking name some of them

0 Answers   IBM,


5. What kind of sorting is this: SORT (k,n) 1.[Loop on I Index] repeat thru step2 for i=1,2,........n-1 2.[For each pass,get small value] min=i; repeat for j=i+1 to N do { if K[j]<k[min] min=j; } temp=K[i];K[i]=K[min];K[min]=temp; 3.[Sorted Values will be returned] A)Bubble Sort B)Quick Sort C)Selection Sort D)Merge Sort

2 Answers   Accenture,






Can you define which header file to include at compile time?

0 Answers   Aspire, Infogain,


What is an volatile variable?

15 Answers   HP,


How can I remove the leading spaces from a string?

0 Answers  


What is extern storage class in c?

0 Answers  


What is structure in c explain with example?

0 Answers  


what is difference between declaring the pointer as int and char in c language?

3 Answers  


Is c call by value?

0 Answers  


Categories