國立屏東商業技術學院 資訊工程系 程式設計(一)
迴圈
[1:18 user@ws ~] ./a.out Please input a number: 5 * *** ***** ******* ********* Please input a number: 7 * *** ***** ******* ********* *********** ************* Please input a number: 0 Good Bye! [1:18 user@ws ~]
[1:18 user@ws ~] ./a.out Please input a number: 5 ***** * * * * * * ***** Please input a number: 7 ******* * * * * * * * * * * ******* Please input a number: 0 Good Bye! [1:18 user@ws ~]
[1:18 user@ws ~] ./a.out Please input a number: 4 +-------+ | * | | * * | | * * | |* 4 *| | * * | | * * | | * | +-------+ Please input a number: 3 +-----+ | * | | * * | |* 3 *| | * * | | * | +-----+ Please input a number: 2 +---+ | * | |*2*| | * | +---+ Please input a number:1 +-+ |1| +-+ Please input a number:0 Good Bye! [1:18 user@ws ~]
[1:18 user@ws ~] ./a.out Please input a number N= 5 1x2x3x4x5=120 Please input a number N= 3 1x2x3=6 Please input a number N= 0 Good Bye! [1:18 user@ws ~]
[1:18 user@ws ~] ./a.out 1 x 1 = 1 4 x 1 = 4 7 x 1 = 7 1 x 2 = 2 4 x 2 = 8 7 x 2 = 14 1 x 3 = 3 4 x 3 = 12 7 x 3 = 21 1 x 4 = 4 4 x 4 = 16 7 x 4 = 28 1 x 5 = 5 4 x 5 = 20 7 x 5 = 35 1 x 6 = 6 4 x 6 = 24 7 x 6 = 42 1 x 7 = 7 4 x 7 = 28 7 x 7 = 49 1 x 8 = 8 4 x 8 = 32 7 x 8 = 56 1 x 9 = 9 4 x 9 = 36 7 x 9 = 63 2 x 1 = 1 5 x 1 = 5 8 x 1 = 8 2 x 2 = 4 5 x 2 = 10 8 x 2 = 16 2 x 3 = 6 5 x 3 = 15 8 x 3 = 24 2 x 4 = 8 5 x 4 = 20 8 x 4 = 32 2 x 5 = 10 5 x 5 = 25 8 x 5 = 40 2 x 6 = 12 5 x 6 = 30 8 x 6 = 48 2 x 7 = 14 5 x 7 = 35 8 x 7 = 56 2 x 8 = 16 5 x 8 = 40 8 x 8 = 64 2 x 9 = 18 5 x 9 = 45 8 x 9 = 72 3 x 1 = 3 6 x 1 = 6 9 x 1 = 9 3 x 2 = 6 6 x 2 = 12 9 x 2 = 18 3 x 3 = 9 6 x 3 = 18 9 x 3 = 27 3 x 4 = 12 6 x 4 = 24 9 x 4 = 36 3 x 5 = 15 6 x 5 = 30 9 x 5 = 45 3 x 6 = 18 6 x 6 = 36 9 x 6 = 54 3 x 7 = 21 6 x 7 = 42 9 x 7 = 63 3 x 8 = 24 6 x 8 = 48 9 x 8 = 72 3 x 9 = 27 6 x 9 = 54 9 x 9 = 81 [1:18 user@ws ~]