C Program To Print Multiplication Table Using For Loop

Lets write a C program to print the multiplication table of the number entered by the user. The table should get displayed in the following form:

Example: Multiplication table of 29
29 x 1 = 29
29 x 2 = 58
29 x 3 = 87
29 x 4 = 116
29 x 5 = 145
29 x 6 = 174
29 x 7 = 203
29 x 8 = 232
29 x 9 = 261
29 x 10 = 290

Related Read:
Basic Arithmetic Operations In C
For Loop In C Programming Language

Simple Mathematical Trick — logical thinking

C Program To Print Multiplication Table Using For Loop



YouTube Link: https://www.youtube.com/watch?v=fjEYZStx5_I [Watch the Video In Full Screen.]


Source Code: C Program To Print Multiplication Table Using For Loop

 
#include<stdio.h>

int main()
{
    int num, count;

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

    printf("Multiplication table for %d is:\n", num);

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

    return 0;
}

Output 1:
Enter a number
5
Multiplication table for 5 is:
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50

Output 2:
Enter a number
10
Multiplication table for 10 is:
10 x 1 = 10
10 x 2 = 20
10 x 3 = 30
10 x 4 = 40
10 x 5 = 50
10 x 6 = 60
10 x 7 = 70
10 x 8 = 80
10 x 9 = 90
10 x 10 = 100

Output 3:
Enter a number
7
Multiplication table for 7 is:
7 x 1 = 7
7 x 2 = 14
7 x 3 = 21
7 x 4 = 28
7 x 5 = 35
7 x 6 = 42
7 x 7 = 49
7 x 8 = 56
7 x 9 = 63
7 x 10 = 70

Output 4:
Enter a number
6
Multiplication table for 6 is:
6 x 1 = 6
6 x 2 = 12
6 x 3 = 18
6 x 4 = 24
6 x 5 = 30
6 x 6 = 36
6 x 7 = 42
6 x 8 = 48
6 x 9 = 54
6 x 10 = 60

Logic: Multiplication Table

We ask the user to enter a number. We initialize for loop counter to 1 and iterate through the loop until loop counter is less than or equal to 10. Inside for loop we multiply the user entered number with the loop counter variable to get the result of multiplication table.

You can also watch C Program To Print Multiplication Table Using While Loop video tutorial.

For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List

For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert