Minggu, 23 Maret 2014

3.29 What does the following program print?

 #include <stdio.h>

 int main( void )
 {
 int count = 1; /* initialize count */


 while ( count <= 10 ) { /* loop 10 times */

 /* output line of text */
 printf( "%s\n", count % 2 ? "****" : "++++++++" );

 count++; /* increment count */

 } /* end while */

 system("pause");

 return 0; /* indicate program ended successfully */

 } /* end function main */
Output:












3.30 What does the following program print?



 #include <stdio.h>

 int main( void )

 {

 int row = 10; /* initialize row */

 int column; /* define column */


 while ( row >= 1 ) { /* loop until row < 1 */

 column = 1; /* set column to 1 as iteration begins */


 while ( column <= 10 ) { /* loop 10 times */

 printf( "%s", row % 2 ? "<": ">" ); /* output */

 column++; /* increment column */

 } /* end inner while */

 row--; /* decrement row */
 printf( "\n" ); /* begin new output line */
 } /* end outer while */
 system("pause");

 return 0; /* indicate program ended successfully */

 } /* end function main */

Output:

23 Mar 2014

0 komentar:

Posting Komentar

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.