C Program to Print Multiplication Table
#include <stdio.h>
int main() {
int i, j, n;
// Input the table range
printf("Enter the number of terms (n): ");
scanf("%d", &n);
// Print the header
printf("\nMULTIPLICATION TABLE\n");
for (i = 2; i <= 6; i++) {
printf("%4d", i); // Align numbers properly
}
printf("\n");
// Print the multiplication values
for (i = 1; i <= n; i++) {
for (j = 2; j <= 6; j++) {
printf("%4d", i * j);
}
printf("\n"); // Move to the next row
}
return 0;
}
Sample Output:
MULTIPLICATION TABLE
2 3 4 5 6
2 3 4 5 6
4 6 8 10 12
6 9 12 15 18
8 12 16 20 24
10 15 20 25 30
12 18 24 30 36
14 21 28 35 42
16 24 32 40 48
18 27 36 45 54
20 30 40 50 60