Others
Maths Puzzle
Programming
Program
What is the output of the program
void main()
{
int i,j,k;
i=2;
j=4;
k=i++>j&2;
printf("%d\n",k);
if(++k && ++i<--j|| i++)
{
j=++k;
}
printf(" %d %d %d",i,-j--,k);
getch();
}
Option
A. 4,-3,2
B. 5,-3,2
C. 4,-2,2
D. 5,-2,2
Read Solution (Total 5)
-
- 0 for first printf()
5,-2,2 for 2nd printf() - 10 years agoHelpfull: Yes(3) No(0)
- There should be 4 printed value.
Option is wrong. - 10 years agoHelpfull: Yes(2) No(2)
- first i=2
j=4
then j&2=0
so k 2>2,
k=0 and i=3
so in if loop k=1 and 4 - 8 years agoHelpfull: Yes(1) No(1)
- option 4) is write ans
- 10 years agoHelpfull: Yes(0) No(1)
- can you please explain !
- 10 years agoHelpfull: Yes(0) No(1)
Others Other Question
4,6,12,18,30,42,60,72,102,108,...
Print next 3 number through c programming.
If a = 26 and sun = 27 then cat = ?