在 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