Exercise 3.13 (Deitel: C How to Program 6th Edition)
What does the following program print?
1 #include <stdio.h>
2
3 int main( void )
4 {
5 int x = 1, total = 0, y;
6
7 while ( x <= 10 ) {
8 y = x * x;
9 printf( "%d\n", y );
10 total += y;
11 ++x;
12 } /* end while */
13
14 printf("Total is %d\n", total);
15 return 0;
16 } /* end main */
Output:
Tidak ada komentar:
Posting Komentar