C Program to Print Table of a Number

Multiplication Table Program

    
#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;
}       
    

Output 1

        
Enter a number : 7
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 2

        
Enter a number : 15
15 x 1 = 15
15 x 2 = 30
15 x 3 = 45
15 x 4 = 60
15 x 5 = 75
15 x 6 = 90
15 x 7 = 105
15 x 8 = 120
15 x 9 = 135
15 x 10 = 150
        
    

Post a Comment

0 Comments