Example C Program to print any Multiplication Table
23 November, 2006
/******************************************
* C Program to print MultiplicationTable *
* Author of the Program: Jagadeesh, M.N. *
* Date 23 Nov 2006 *
* ***************************************/
#include<stdio.h>
main()
{
int i, p=1, table[10]; /* define integres and array */
/* ***************************
* Output Formating Begins
* ***************************/
for(i=0;i<61;i++)
printf("#");
printf("\n# Program to print Multiplication table of any number");
printf("\n# NOTE: To exit type 0 \n");
for(i=0;i<61;i++)
printf("#");
/* ***************************
* Output Formating ENDS
* ***************************/
while(p != 0)
{
printf("\nWhich table ");
scanf("%d",&p); /* takes input from input */
for(i=0;i<10;i++) /* Fills the array */
{
if(p==0) /* Stratagy to exit the program Benins */
{
printf("Exiting\n");
break;
} /* Stratagy to exit the program ends */
table[i]=i+1; /* Fills the array with numbers 1 - 10 */
printf("%2d x %2d = %2d\n", p, table[i], p * table[i]);
}
}
}
* C Program to print MultiplicationTable *
* Author of the Program: Jagadeesh, M.N. *
* Date 23 Nov 2006 *
* ***************************************/
#include<stdio.h>
main()
{
int i, p=1, table[10]; /* define integres and array */
/* ***************************
* Output Formating Begins
* ***************************/
for(i=0;i<61;i++)
printf("#");
printf("\n# Program to print Multiplication table of any number");
printf("\n# NOTE: To exit type 0 \n");
for(i=0;i<61;i++)
printf("#");
/* ***************************
* Output Formating ENDS
* ***************************/
while(p != 0)
{
printf("\nWhich table ");
scanf("%d",&p); /* takes input from input */
for(i=0;i<10;i++) /* Fills the array */
{
if(p==0) /* Stratagy to exit the program Benins */
{
printf("Exiting\n");
break;
} /* Stratagy to exit the program ends */
table[i]=i+1; /* Fills the array with numbers 1 - 10 */
printf("%2d x %2d = %2d\n", p, table[i], p * table[i]);
}
}
}