輸出乘法口訣表

#include<stdio.h>
#include<stdlib.h>
int main(){
    int a, b, c;
    int n = 9;
    for (a = 1; a <= n; a++){
        for (b = 1; b <= a; b++){
            c = a*b;
            //輸出a,b,c三個數 因此格式爲"%d*%d=%d"   %-2d 使之左對齊
            printf("%d*%d=%-2d  ", a, b, c);
        }
        //換行
        printf("\n");
    }
    system("pause");
    return 0;
}blog

相關文章
相關標籤/搜索