Tuesday, February 5, 2019

Multiplication Table

Write a program in C to print multiplication table.

Code:

#include <stdio.h>

int main()
{
    int num,i,prod;
    printf("Enter an integer: ");
    scanf("%d", &num);
    printf("\nThe multiplication table of %d is:",num);
    for(i=1;i<=10;i++){
        prod = num * i;
        printf("\n %d X %d = %d",num,i,prod);
    }
    return 0;
}

No comments: