find a number whether it is even or odd without using any
control structures and relational operators?

Answer Posted / rohit agarwal

#include<stdio.h>
#include<conio.h>
main()
{
int n;
char *p[]={"Even","odd"};
clrscr();
printf("Enter the number");
scanf("%d",&n);
n=n%2;
printf("The value is %s",p[n]);
getch();

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

1674


What is a char in c?

554


How can I rethow can I return a sequence of random numbers which dont repeat at all?

704


What is the right type to use for boolean values in c?

583


Is it fine to write void main () or main () in c?

547






What is huge pointer in c?

584


Can we use visual studio for c?

549


what value is returned to operating system after program execution?

1604


How can I pad a string to a known length?

611


Write a factorial program using C.

643


What is volatile variable in c?

658


What is struct node in c?

617


What is page thrashing?

651


Why is it usually a bad idea to use gets()? Suggest a workaround.

904


Can we replace the struct function in tree syntax with a union?

780