Home  >  Article  >  Backend Development  >  c language to print multiplication table

c language to print multiplication table

王林
王林Original
2020-05-13 10:52:277495browse

c language to print multiplication table

The specific code is as follows:

#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;
}

The running results are as follows:

c language to print multiplication table

The operation after removing the loop The results are as follows:

c language to print multiplication table

# Recommended tutorial: c language tutorial

The above is the detailed content of c language to print multiplication table. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn