C Program to Generate multiple Multiplication Tables


In this program, we will write multiplication tables for different numbers entered by the user. As we all know, writing a multiplication table is a very lengthy task, but C programming makes it very simple for users.

Suppose the user wishes to print multiplication tables of some numbers in a serial order. Then this code will help him/her to achieve his task.

In this program, we will use two ‘for’ loops to complete this task.

To understand this example, you should know about

1. C programming operators

2. C for loop



int main()


int num1,num2;

printf("Enter an integer value(Value for first table)\n");


printf("Enter an integer value(Value for last table)\n");


for(int i=num1; i<=num2; i++)


printf("Multiplication Table of %d is:\n",i);

for(int j=1; j<=10; j++)


printf("%d * %d = %d\n",i,j,i*j);



return 0;





The value of num1 and num2 entered by the user is 12 and 16, respectively.

It means the user wants to print the multiplication tables from 12 to 16.

for(int i=num1; i<=num2; i++)

The iterator ‘i’ starts from num1 i.e., 12, and will iterate up to 16.

For ‘i=12’, the below code will work and print the multiplication table of 12.

printf(“Multiplication Table of %d is:\n”,i);

for(int j=1; j<=10; j++)


printf(“%d * %d = %d\n”,i,j,i*j);


Now the value of ‘i’ will get incremented and become 13.

Same as above multiplication table of 13 is printed, and similarly, the code will work for 14, 15, and 16.



  • Barry Allen

    A Full Stack Developer with 10+ years of experience in different domain including SAP, Blockchain, AI and Web Development.

    View all posts


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.