Write a program to print the multiplication table of an integer n upto m rows using a while loop.
Input Format:
Input consists of 2 integers. The first integer corresponds to n. The second integer corresponds to m.
Output Format:
Refer Sample Input and Output for formatting specifications.
[All text in bold corresponds to input and the rest corresponds to output]
Sample Input and Output:
Enter n
5
Enter m
4
The multiplication table of 5 is
1*5=5
2*5=10
3*5=15
4*5=20
Code:
#include<stdio.h>
int main(){
int m,n,i=1;
printf("Enter n\n");
scanf("%d",&n);
printf("Enter m\n");
scanf("%d",&m);
printf("The multiplication table of %d is\n",n);
while(i<=m)
{
printf("%d*%d=%d\n",i,n,(i*n));
i++;
}
return 0;
}
No comments:
Post a Comment