Saturday, January 30, 2010

CHAP 3[E]h Printing multiplication tables

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


void main()
{
int x;
float n,r;
printf("Enter a number to have the multiplication table displayed");
scanf("%f",&n);

for(x=1;x<=25;x++)
{
r=n*x;
printf("\n%f*%d=%f",n,x,r);
}
}

No comments:

Post a Comment