In this program, we are going to see how we can print the multiplication table of any user given input number.

Logic

Printing multiplication table of any number is quite simple and an easy task. After taking input (num) from the user we have to start one loop from 1 to 10, and then inside the loop simply multiply num by current number “i” and print it.

Program

#include <stdio.h>

int main() {

    int i, num;

    // Take input from user
    printf("Enter number to print table : ");
    scanf("%d", &num);
    
    printf("\n");
    for(i = 1; i <= 10; i++) {

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

    return 0;
}

Output

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