This article is from solution of Let Us C by Yashwant Kanetkar. I also posted many another articles regarding solutions of Let Us C. If you have any problem regarding solution then give comment, I will surely reply your question.
Q. Write a program to print the multiplication table of the number entered by the user. The table should get displayed in the following form:
29 * 1 = 29
29 * 2 = 58
......
Ans.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n, i, ans;
printf("Enter any number ");
scanf("%d",&n);
for(i=1;i<=10;i++)
{
ans=n*i;
printf("\n%2d * %2d = %3d",n,i,ans);
}
getch();
}