Pages

Labels

C Program to display multiplication table by user defined

This program shows the multiplication of any user defined number.

#include<stdio.h>
#include<conio.h>
main() {
    int n, i ,b = 0;
    printf("Enter Number: ");
    scanf("%d",&n);
    for(i=1; i <= 10; i++) {
        b = n*i;
        printf("%d X %d = %d\n", n, i, b);
    }
}

Output:
If input by user is 5

5 X 1 = 5
5 X 2 = 10
5 X 3 = 25
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

It runs a loop from 1 to 10 and multiplies with user provided input and gives output as above format.

Followers