C program to print multiplication table by using for Loop

A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times. In this tutorial, we will learn how to print a multiplication table using a for loop in C.

Syntax

for (initialization; condition; increment/decrement) {
    // statements to be executed
}

Algorithm

Given below is an algorithm to print multiplication table using for loop in C language −

Step 1: Enter a number to print table at runtime.
Step 2: Read that number from keyboard.
Step 3: Using for loop print number*i 10 times.
        // for(i=1; i<=10; i++)
Step 4: Print num*i 10 times where i=1 to 10.

Example

Following is the C program for printing a multiplication table for a given number −

#include <stdio.h>

int main() {
    int i, num;
    
    /* Input a number to print table */
    printf("Enter number to print table: ");
    scanf("%d", &num);
    
    printf("\nMultiplication table of %d:<br>", num);
    
    for(i = 1; i <= 10; i++) {
        printf("%d * %d = %d<br>", num, i, (num * i));
    }
    
    return 0;
}

Output

When the above program is executed, it produces the following result −

Enter number to print table: 7

Multiplication table of 7:
7 * 1 = 7
7 * 2 = 14
7 * 3 = 21
7 * 4 = 28
7 * 5 = 35
7 * 6 = 42
7 * 7 = 49
7 * 8 = 56
7 * 9 = 63
7 * 10 = 70

How It Works

  • The for loop initializes the counter variable i to 1.
  • The condition i <= 10 is checked before each iteration.
  • If the condition is true, the multiplication statement is executed.
  • After each iteration, i is incremented by 1.
  • The loop continues until i becomes greater than 10.

Conclusion

The for loop provides an efficient way to print multiplication tables by controlling the number of iterations precisely. This approach is clean, readable, and demonstrates the power of loop structures in C programming.

Updated on: 2026-03-15T13:17:16+05:30

83K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements