#include <stdio.h>

int main() {
    int count = 0;
    printf("   |");
    for (int i = 1; i <= 9; i++) {
        printf("%3d", i);
    }
    printf("\n---+");
    for (int i = 1; i <= 9; i++) {
        printf("---");
    }
    printf("\n");
    for (int i = 1; i <= 9; i++) {
        printf("%2d |", i);
        for (int j = 1; j <= i; j++) {
            printf("%3d", i * j);
            count++;
        }
        printf("\n");
    }
    printf("共有%d个算式\n", count);
    printf("十六进制:%x\n", count);
    return 0;
}

输出结果:

   |  1  2  3  4  5  6  7  8  9
---+-------------------------
 1 |  1
 2 |  2  4
 3 |  3  6  9
 4 |  4  8 12 16
 5 |  5 10 15 20 25
 6 |  6 12 18 24 30 36
 7 |  7 14 21 28 35 42 49
 8 |  8 16 24 32 40 48 56 64
 9 |  9 18 27 36 45 54 63 72 81
共有45个算式
十六进制:2d
用c语言写一个乘法口诀表要求:左对齐算出共有多少算式换算为十六进制

原文地址: https://www.cveoy.top/t/topic/WqH 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录