multiplication table

The multiplication table needs two tables for Loop to control rows and columns , meanwhile , Internal circulation should be less than or equal to external circulation . Use two examples to illustrate the multiplication table , One is the nine nine multiplication table , One is the multiplication table specified by the number of rows and columns written by the function

multiplication table
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> int main
() { int i, j; for (i = 1; i <= 9; i++) { for (j = 1; j <= i; j++)
printf("%d*%d=%d\t", i,j,i*j); printf("\n"); } system ( "pause" ); return 0; }

A multiplication table with the number of rows and columns specified by itself

Using function to realize ,n Represents the number of rows and columns ( Same number of rows and columns )
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> void
mult_print(int n) { int i; int j; for (i = 1; i <= n; i++) { for (j = 1; j <=
i; j++) { //return (i, j, i*j); printf("%d*%d=%d ", i, j, i*j); } printf("\n");
} } int main() { int n=0; printf(" Enter the number of rows you want to implement the formula table ( The number of columns is the same as the number of rows ):"); scanf("%d", &n);
mult_print(n); system("pause"); return 0; }
 

 

 

Technology