C Program to Print Multiplication Table of Given Number

Subject: PPS (Programming for Problem Solving)

Contributed By: Sanjay

Created At: February 3, 2025

Question:


Write a C Program to Print Multiplication Table of Given Number

Explanation Video:

Custom Image

Explanation:

 

  • We use a for loop to iterate from 1 to 10.
  • In each iteration, we multiply the given number by the loop variable (i).

    Loop Explanation:

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

i = 1: Prints num x 1 = result

i = 2: Prints num x 2 = result

i = 10: Stops after printing num x 10 = result.

Source Code:
#include <stdio.h>
int main() {
    int num, i;

    printf("Enter a number: ");
    scanf("%d", &num);

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

    return 0;
}
Input:
Enter a number: 5
Output:
5 x 1 = 5
5 x 2 = 10
5 x 3=15
...
5 x 10 = 50
Share this Article & Support Us:
Status
printf('Loading...');