First Encounter with ACM — Multiplication Table

Words: 75

What struck me most at the time was…

The nine-nine multiplication table only takes this little code to print?

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#include <stdio.h>
int main(){
    int i,j,n;
    for(i=1;i<=9;i++){
        // 将下面的for循环注释掉,就输出左下三角形
      //  for(n=1; n<=9-i; n++)
        //    printf("        ");

        for(j=1;j<=i;j++)
            printf("%d*%d=%2d  ",i,j,i*j);

        printf("\n");
    }
    return 0;
}

Later I heard that the nine-nine multiplication table was senior Liu Ke’s entry problem into ACM.

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...