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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

1547


Is a house a shell structure?

699


What is #error and use of it?

681


Explain the bubble sort algorithm.

650


What is the use of clrscr?

602






You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.

1785


What standard functions are available to manipulate strings?

567


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

622


What does c mean?

592


How many parameters should a function have?

670


Why doesnt that code work?

604


What is your stream meaning?

610


What is the difference between %d and %i?

598


Write a program to print fibonacci series using recursion?

591


Why does everyone say not to use scanf? What should I use instead?

683