Multiplication table program in c
This program will compute the multiplication table of a given integer value from the user for the given specific number of rows. For example, if the user entered an input value 5 and the number of rows is 10 then it will form a multiplication table of 5 with 10 rows.
#include <stdio.h>
int main()
{
int r,n,i;
printf("Enter no of rows:");
scanf("%d",&r);
if(r>0)
{
printf("Enter a value:");
scanf("%d",&n);
i=1;
while(i<=r)
{
printf("\n%d*%d=%d",n,i,n*i);
i=i+1;
}
}
else
printf("\ninvalid row value");
return 0;
}
[quote]
Output:
Enter no of rows:10
Enter a value:5
5*1=5
5*2=10
5*3=15
……….
………
5*8=40
5*9=45
5*10=50
[/quote]
Multiplication table program in c language
This program will compute the multiplication tables of given two integer value from the user for the 10 rows. For example, if the user entered input values 2 and 4 then it will form multiplication tables from 2 to 4 for 10 rows.
#include <stdio.h>
int main()
{
int n1,n2,n,i;
printf("Enter two values: ");
scanf("%d%d",&n1,&n2);
i=1;
while(i<=10)
{
printf("\n");
n=n1;
while(n<=n2)
{
printf("%3d*%2d=%2d",n,i,n*i);
n=n+1;
}
i=i+1;
}
return 0;
}
[quote]
Output:
Enter two values: 2 4
2* 1= 2 3* 1= 3 4* 1= 4
2* 2= 4 3* 2= 6 4* 2= 8
2* 3= 6 3* 3= 9 4* 3=12
………. ……….. ……….
2* 9=18 3* 9=27 4* 9=36
2*10=20 3*10=30 4*10=40
[/quote]