Search This Blog

Program to Display Multiplication Table of Given Number

This is a c program to display multiplication table of given number. For program to display multiplication table of all numbers from 1 to 10, see this post: Program to display multiplication table of all numbers from 1 to 10
#include <stdio .h>
void main()
{
    int n, i;
    printf("Enter the number:");
    scanf("%d",&n);
    for(i=1; i<=10; ++i)
        printf("%d * %d = %d \n", i, n, n*i);
}

Output:

Enter the number:5
1 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50

No comments: