[My site ]
Main » 2013 » December » 13 » 2010-2011 question 4
0:01 AM
2010-2011 question 4
what is the output of : explain your answer 

#include"stdio.h"
main()
{
int i;
char a, b='A', c=b+3;
for(i=1;i<=6;i++,b=1,c=a+3)
{
for(a=b;a<=c;a++)
printf("%c", a);
printf("\n");
}
for(b=a;b<=a+1;b++)
printf("%c", b);
getch();
return 0;
}

answer

a = ?? , b = A , c = D
i = 1 <= 6
a = b = A ,, a <= c ,, A<= D
print a ,,, A 
a++ ,,, a = B <= D
print a ,,, B
a++ ,,, a = C <= D
print a ,,, C

a++ ,,, a = D <= D
print a ,,, D
a++ ,,, a = E
ABCD ,,, new line and back to i for
b = a = E
c = a + 3 = H
and so on 6 times
ABCD
EFGH
IJKL
MNOP
QRST
UVWX

b = a = Y <= a+1 <= Z
2nd for print YZ





Category: C Programming - 1 | Views: 378 | Added by: ahansaary | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Sign Up | Login ]