C output type question
Q. C programming:
main()
{
int x;
if ( x > 4) printf( “Brinda”);
else if ( x > 10) printf( “Karthik”);
else if ( x > 21 ) printf(“ Pradeep”);
else printf( “Sandeep”);
}
What will be the value of x so that “Karthik” will be printed?- Published on 24 Jun 15a. From 10 to 21
b. From 11 to 21
c. Grater then 10
d. None
ANSWER: None
The logic for this program would be if x> 4 Brinda will be printed if x>10 Brinda and Karthik will be printed and x> 21 Brinda,Karthik and Pradeep will be printed. Hence, None would be the answer for the above program.