1. 程式人生 > >用c語言列印9*9乘法口訣表

用c語言列印9*9乘法口訣表

#define  _CRT_SECURE_NO_WARNINGS//防止scanf函式呼叫時不安全
#include<stdio.h>
#include<stdlib.h>
//定義print_table函式,列印9*9乘法口訣表
	void print_table(){
		int row = 0;
		int col = 0;
		int line = 0;
		scanf("%d", &line);
		for (int row = 1; row <= line; row++){
			for (int col = 1; col <= row; col++){
				printf("%d*%d=%d ", row, col, row*col);
			}
			printf("\n");
		}
	}
	int main(){

		print_table();
		system("pause");
	return 0;
}