Problem
Create a program that prints the multiplication table of a number entered by the user (user enter x and y and your program will print the table of x upto y). The table should get displayed in the following form.2* 1 = 2
2* 2 = 4
Solution - Code
#include<stdio.h>int main()
{
int x,y,i;
printf("Enter x and y: ");
scanf("%d%d",&x,&y);
i=1;
while(i<=y)
{
printf("%d*%d=%d\n",x,i,x*i);
i = i + 1;
}
system("pause");
return 0;
}
Write a C program to Print table of entered number by user through keyboard using for loop.
ReplyDeleteCode of given problem:
int main()
{
int i=0,num;
printf("Enter the number to find its table:\t");
scanf("%d", &num);
for(i=1;i<=10;i++)
{
printf("%d\n",num*i);
}
return 0;
}
Very informative blog!
Please take some time to visit my blog @
for loop program examples
Thanks!