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

Answer Posted / anandi

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

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does int main () mean?

537


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

674


Can I initialize unions?

578


Explain what are its uses in c programming?

584


Write a Program to find whether the given number or string is palindrome.

604






What are lookup tables in c?

539


Why do we use static in c?

624


How to write a code for reverse of string without using string functions?

1568


Are global variables static in c?

661


Explain how do you view the path?

642


What is the use of the function in c?

589


Explain the concept and use of type void.

619


Tell us two differences between new () and malloc ()?

607


what is the function of pragma directive in c?

611


Why do we use & in c?

580