TCS
Company
Logical Reasoning
Mathematical Reasoning
What will be the output of the following?
int i=5; i=i++ + i++ + i++ + i++ + i++;
printf("%d,i);
i=++i + ++i + ++i + ++i + ++i ;
printf("%d, i);
Read Solution (Total 7)
-
- 5+6+7+8+9=35
36+37+38+39+40=190 - 9 years agoHelpfull: Yes(9) No(3)
- 5+6+7+8+9=35 (with a value of i=36)
then 37+38+39+40+41=195
thus output is
35195 (no new line) - 9 years agoHelpfull: Yes(2) No(1)
- 5*5 +5= 30
30+5=35*5=175 - 9 years agoHelpfull: Yes(1) No(1)
print - 35
print - 191- 9 years agoHelpfull: Yes(1) No(0)
- quotations are not closed in printf () it will give error
if it is a type mistake then the answer will be 35 and 91 - 9 years agoHelpfull: Yes(0) No(0)
- First of all , the above program will result COMPILATION ERROR due to INCORRECT SYNTAX, missing " after %d , printf("%d", i); will be there,
After correcting the Syntax OUTPUT will be 30166 ACCORDING TO 32 BIT C Compiler - 9 years agoHelpfull: Yes(0) No(0)
- 25 post
30 pre - 9 years agoHelpfull: Yes(0) No(1)
TCS Other Question