Pages

Wednesday

Program to Print the Multiplication Table

Here is a program to print the multiplication table using for loop in C programming language with output.

# include <stdio.h> 
# include <conio.h> 
void main() 
{ 
 int i, t, n ; 
 clrscr() ; 
 printf("Enter the table : ") ; 
 scanf("%d", &t) ; 
 printf("\nEnter the limit : ") ; 
 scanf("%d", &n) ; 
 printf("\nThe table is :\n\n") ; 
 for(i = 1 ; i <= n ; i++) 
  printf("%4d x %4d = %4d\n", i, t, i * t) ; 
 getch() ; 
} 

Output of above program

Enter the table : 3

Enter the limit : 12

The table is :

   1 x    3 =    3
   2 x    3 =   6
   3 x    3 =   9
   4 x    3 =   12
   5 x    3 =   15
   6 x    3 =   18
   7 x    3 =   21
   8 x    3 =   24
   9 x    3 =   27
  10 x    3 =   30
  11 x    3 =   33
  12 x    3 =   36
 

1 comment: