C Program To Display Multiplication Tables
Problem : Write a program to display multiplication tables from ___ to ___ having n multiples each.The output should be displayed in tabular format.
For example : Tables from 4 to 6 having 10 multiples each is shown below :
For example : Tables from 4 to 6 having 10 multiples each is shown below :
C program to print tables
#include<tdio.h>
int main()
{
int x,i,t,a,b,n;
printf("\n \n Display tables from a to b : ");
scanf("%d%d",&a,&b);
printf("\n \n How many multiples should be displayed : ");
scanf("%d",&n);
printf("\n \n");
for (i=1;i<=n;i++)
{
for (x=a;x<=b;x++)
{
t=x*i;
printf("%d X %d = %d \t",x,i,t);
}
printf("\n");
}
return 0;
}
Output:
Display tables from a to b: 1 10 How many multiples should be displayed: 10 1 X 1 = 1 2 X 1 = 2 3 X 1 = 3 4 X 1 = 4 5 X 1 = 5 6 X 1 = 6 7 X 1 = 7 8 X 1 = 8 9 X 1 = 9 10 X 1 = 10 1 X 2 = 2 2 X 2 = 4 3 X 2 = 6 4 X 2 = 8 5 X 2 = 10 6 X 2 = 12 7 X 2 = 14 8 X 2 = 16 9 X 2 = 18 10 X 2 = 20 1 X 3 = 3 2 X 3 = 6 3 X 3 = 9 4 X 3 = 12 5 X 3 = 15 6 X 3 = 18 7 X 3 = 21 8 X 3 = 24 9 X 3 = 27 10 X 3 = 30 1 X 4 = 4 2 X 4 = 8 3 X 4 = 12 4 X 4 = 16 5 X 4 = 20 6 X 4 = 24 7 X 4 = 28 8 X 4 = 32 9 X 4 = 36 10 X 4 = 40 1 X 5 = 5 2 X 5 = 10 3 X 5 = 15 4 X 5 = 20 5 X 5 = 25 6 X 5 = 30 7 X 5 = 35 8 X 5 = 40 9 X 5 = 45 10 X 5 = 50 1 X 6 = 6 2 X 6 = 12 3 X 6 = 18 4 X 6 = 24 5 X 6 = 30 6 X 6 = 36 7 X 6 = 42 8 X 6 = 48 9 X 6 = 54 10 X 6 = 60 1 X 7 = 7 2 X 7 = 14 3 X 7 = 21 4 X 7 = 28 5 X 7 = 35 6 X 7 = 42 7 X 7 = 49 8 X 7 = 56 9 X 7 = 63 10 X 7 = 70 1 X 8 = 8 2 X 8 = 16 3 X 8 = 24 4 X 8 = 32 5 X 8 = 40 6 X 8 = 48 7 X 8 = 56 8 X 8 = 64 9 X 8 = 72 10 X 8 = 80 1 X 9 = 9 2 X 9 = 18 3 X 9 = 27 4 X 9 = 36 5 X 9 = 45 6 X 9 = 54 7 X 9 = 63 8 X 9 = 72 9 X 9 = 81 10 X 9 = 90 1 X 10 = 10 2 X 10 = 20 3 X 10 = 30 4 X 10 = 40 5 X 10 = 50 6 X 10 = 60 7 X 10 = 70 8 X 10 = 80 9 X 10 = 90 10 X 10 = 100