Skip to content
Home » Print Multiplication Table from 1 to N in C

Print Multiplication Table from 1 to N in C

Learn about Print Multiplication Table from 1 to N in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

Print Multiplication Table from 1 to N

The below program prints the multiplication table from 1 to given number. The number is taken from the user input and for loop is used to print the multiplication tables.

Source code:

#include<stdio.h>
int main()
{
   int n, t, i;

   printf("Enter number of tables: ");
   scanf("%d",&n);

   for(i=1; i<=10; i++)
   {
     for(t=1; t<=n; t++)
     printf("%d*%d=%d\t",t,i,t*i);
     printf("\n");
   }

   return 0;
}

Output:

Enter number of tables: 2
1*1=1	2*1=2	
1*2=2	2*2=4	
1*3=3	2*3=6	
1*4=4	2*4=8	
1*5=5	2*5=10	
1*6=6	2*6=12	
1*7=7	2*7=14	
1*8=8	2*8=16	
1*9=9	2*9=18	
1*10=10	2*10=20

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C program to print multiplication table from 1 to 10
C Program to print Multiplication table using do while loop