Write a Program to Generate a Multiplication Table of a given number.
C Program
#include <stdio.h>int main(){int n;printf("Enter a number : ");scanf("%d", &n);printf("Table of %d is\n", n);for (int i = 1; i <= 10; i++){printf("%d X %d = %d\n", n, i, n * i);}return 0;}
Input:
Enter a number : 6
Output:
Table of 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
No comments:
Post a Comment