C Program to Generate Multiplication Table

by | Jan 23, 2023 | C, C Programs

Home » C » C Programs » C Program to Generate Multiplication Table


In this program, we will write a multiplication table of any value 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.

There are many ways in C programming to generate a multiplication table.

In this program, we will use the ‘for’ loop to complete this task.

To understand this example, you should know about

1. C programming operators

2. C for loop



int main()


int num;

printf("Enter an integer\n");


int i; // iterator i

for(i=1; i<=10; i++) // ‘i’ will iterate up to 10


printf("\n %d * %d = %d",num, i, i*num); // proper systematic statement is made so that the output looks like a multiplication table


return 0;





Here, the input given by the user is stored in the ‘int’ variable num.

Thereafter, we will use a ‘for’ loop to print the multiplication table up to 10.

for(i=1; i<=10; i++)


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


The loop iterates from ‘i=1’ up to ‘i=10’, and in each iteration ‘num*i’ is printed.

Note :

1. Moreover, we can modify the above program by asking the user to enter the range up to which he/she wants to print the multiplication table.

2. The same program can be made using functions also. The procedure is as follows:

2.1 Declare a function by passing an ‘int’ variable as an argument and write the ‘for’ loop statement in the definition of the function.

2.2 Call the ‘main function bypassing the integer to generate the multiplication table.



Submit a Comment

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.