Method 1: The following program generates a multiplication table for a given integer to a given range.
#include <stdio.h>
int main() {
int n, range, i;
printf("Enter the value of n: ");
scanf("%d",&n);
printf("\nEnter the range: ");
scanf("%d",&range);
for(i=1;i<=range;++i) {
printf("%2d X %2d = %3d\n", n, i, n*i);
}
return 0;
Method 2: The following program generates multiplication tables for each integers from 1 to n (depends on your choice) to a range of 1 to 16.
#include <stdio.h>
int main () {
int i, j, n;
printf("Enter the value for n: ");
scanf("%d", &n);
for (i = 1; i <= n; i++) {
printf("\nMultiplicaton table for %d\n",
i);
for (j = 1; j <= 16; j++) {
printf("%2d X %2d = %3d\n", i, j, i * j);
}
printf("\n");
}
return 0;
}