How to find the given no is odd or even without checking of
any condition and loops. (Hint: Using array)

Answer Posted / vaishu

void main()
{
int n;
char s[]={"even","odd"};
printf("Enter the no.:");
scanf("%d",&n);
n=n%2;
printf("th no. is %s",s[n]);
getch();
}

Is This Answer Correct ?    12 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1655


Who is the main contributor in designing the c language after dennis ritchie?

537


Are c and c++ the same?

620


Why structure is used in c?

572


How can you find the exact size of a data type in c?

587






How can you read a directory in a C program?

642


Are bit fields portable?

666


ATM machine and railway reservation class/object diagram

4792


In c programming language, how many parameters can be passed to a function ?

618


what is stack , heap ,code segment,and data segment

2208


What are pointers? Why are they used?

623


How can I find out the size of a file, prior to reading it in?

610


How can I sort a linked list?

626


What do header files do?

594


What is data type long in c?

613