Others
Maths Puzzle
Logical Reasoning
Blood Relations
#include
#include
void main()
{
int j=5;
int i;
i=(j++,j++);
printf("%d",i);
getch();
}
Read Solution (Total 9)
-
- ans is 6
bcos i=(j++,j++) it treats as 2 statements
i=j++; and i=j++;
so in first statements i assigns 5 and increase j=6
and next statement i gets 6 and j increased as 7.
so finally i gets 6. - 14 years agoHelpfull: Yes(10) No(5)
- The statement like "i=(j++,j++); " is not used in C programming.
I think there may be any arithmetic operator that need to be come in between them.
If statement be j++ + j++ ans : 10
If statement be j++ - j++ ans : 0
If statement be j++ * j++ ans : 25
If statement be j++ / j++ ans : 1
Reason: In C ++ operator will execute only after the entire line hence statement will be like this i=j+j.
- 14 years agoHelpfull: Yes(4) No(4)
- It prints 6
- 14 years agoHelpfull: Yes(3) No(2)
- 6
- 14 years agoHelpfull: Yes(3) No(0)
- 6
- 14 years agoHelpfull: Yes(2) No(3)
- Prints 5
- 14 years agoHelpfull: Yes(1) No(6)
- error
- 14 years agoHelpfull: Yes(1) No(4)
- it will show an error
- 9 years agoHelpfull: Yes(0) No(2)
- either it shows error cuz without header files
or it will print an ans as 6
i just checked by compiling this code ....it shows an error cuz header files aint included
then when applied it worked and o/p as 6 - 5 years agoHelpfull: Yes(0) No(0)
Others Other Question