Just Google it!!

[C語言]2009.10.21 #4 C程式語言 進階迴圈控制

2009/10/21
運算簡寫
x = x + 1;
x += 1;
x++;
y = y * 2;
y *= 2;

C 語言範例: for 迴圈印出九九乘法表
#include <stdio.h>
#include <stdlib.h>
int main(void) {
    for(int i=1; i<=9; i++) {
       for (int j=1; j<=9; j++) {
           printf("%d * %d = %d", i, j, i*j);
       }
       printf("\n");
     }
     
     system("pause");
     return 0;
}

[C語言]2009.10.07 #3 C程式語言進階

2009/10/6
課程目標
1.複習上週變數與輸入
2.瞭解「迴圈」的初步應用

C 語言範例: 計算 1+2+...+10 的結果
#include <stdio.h>
#include <stdlib.h>
int main(void) {
    int i,total=0; // 宣告兩個變數
    for(i=1; i<11; i++) { // 從 1 到 10
    total = total + i; // 將 i 加進 total
    }
    printf("答案是: %d\n", total);
    system("pause");
    return 0;
}