C Program to Generate Multiplication Table - Custom Table Length

Generate a Multiplication Table

#include <stdio.h>

int main() {
    int number;

    printf("Enter an integer: ");
    scanf("%d", &number);

    printf("Multiplication table of %d:\n", number);

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

    return 0;
}
Enter an integer: 3
Multiplication table of 3:
3 x 1 = 3
3 x 2 = 6
3 x 3 = 9
3 x 4 = 12
3 x 5 = 15
3 x 6 = 18
3 x 7 = 21
3 x 8 = 24
3 x 9 = 27
3 x 10 = 30
        

A multiplication table is just repeated addition or multiplication. This program uses a simple loop that starts at 1 and multiplies the input number by each value up to 10. You can change the loop limit (here it’s 10) to display a longer or shorter table.

Sai Kishore Randhi, author
About the author

Sai Kishore Randhi

Embedded systems, VLSI, and chip design

Sai Kishore writes about embedded systems, VLSI, chip design, and the programming concepts behind modern hardware.

View LinkedIn profile ↗