Welcome Guest | Sign in | Register
If statements - Discussion Page For Q.10504 | C Programming Questions and Answers | C Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > If statements > Questions and Answers

Q: What will be the output
main()
{
int i;
i = 10;
if(i == 20 || 30)
{
printf("True");
}
else
{
printf("False");
}
}
A. True B. False
C. Syntax Error D. Run time Error

Answer and Explanation

Answer:True

Explanation:
i==20 is a expression which will return TRUE or FALSE depending on the value of i. In this program it will return 0 so the statement become
If ( 0 || 30)
30 is a nonzero value which means TRUE (1) in C when ORed with 0 will result TRUE.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.