คำอธิบายโปรแกรม
พิมพ์ตารางการคูณของจำนวนที่กำหนด
อัลกอริทึม
ยอมรับหมายเลขใด ๆ จากผู้ใช้ที่เราจำเป็นต้องสร้างตารางสูตรคูณ
คูณตัวเลขที่กำหนดขึ้นต้นด้วยค่าของ 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("\n");
for(i=1;i<=12;i++){
printf("%d x %d = %d", number, i, number * i);
printf("\n");
}
getch();
return 0;
} ผลลัพธ์
