Write the output for the following C program
main( ) { int a = 2, s = 0, j = 1; for ( ; a < 10; a+=3, j++) { s += a * a * a; printf("\n a = %d j = %d", a, j); } printf("\n j=%d a=%d s=%d", j, a, s); } |
---|
Output | ||
---|---|---|
a=2 | j=1 | |
a=5 | j=2 | |
a=8 | j=3 | |
j=4 | a=11 | s=645 |
main( ) { int a = 2, s = 0, j = 1; for ( ; a < 10; a+=3, j++) { s += a * a * a; printf("\n a = %d j = %d", a, j); } printf("\n j=%d a=%d s=%d", j, a, s); } |
---|
Output | ||
---|---|---|
a=2 | j=1 | |
a=5 | j=2 | |
a=8 | j=3 | |
j=4 | a=11 | s=645 |
© Blogger templates Newspaper III by Ourblogtemplates.com 2008
Back to TOP
0 comments:
Post a Comment