在 C 中打印给定数字的乘法表
程序说明
打印给定数字的乘法表
算法
从用户那里接收一个数字以形成乘法表。
从值 I (=1) 开始,将给定的数字相乘。
通过增加 I 的值,将给定的数字相乘,直至 I 的值小于或等于 12。
范例
/* Program to print the multiplication table of a given number */
#include <stdio.h>
int main() {
int number, i;
clrscr();
printf("Please enter any number to find multiplication table:");
scanf("%d", &number);
printf("Multiplication table for the given number %d: ", number);
printf("
");
for(i=1;i<=12;i++){
printf("%d x %d = %d", number, i, number * i);
printf("
");
}
getch();
return 0;
}输出

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP