Translate

Labels

Saturday 22 December 2012

A C PROGRAM TO PRINT MULTIPLICATION TABLE


main()
{
int x,n,z;
for(x=1;x<=3;x++)
{
printf("\n Multiplication table for%d:",x);
for(n=1;n<=10;n++)
{
z=n*x;
printf("\n%d*%d=%d",x,n,z);
}
getch();
}
}

  • By above program you can print so many tables as your need.
  • In this program, x is multiplier
  •                            n is multiplicand
  •                            z is product.
  • It is the nested for loop program, the first for loop is used to determine the multipliers which the user requires.second for loop is used to determine the multiplicand.
  • z=n*z    in this statement the multiplicand and the multiplier are multiplied and then the value is assigned to the product(Z).

No comments: