Write C program to print multiplication table of a given number
#include <stdio.h> int main() { int i, num; //Reading number printf("Enter number to print table: "); scanf("%d", &num); for(i=1; i<=10; i++) { //Printing table of number entered by user printf("%d x %d = %d\n", num, i, (num*i)); } return 0; }
Result:
Enter number to print table: 5
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
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
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Result:
Enter number to print table: 5
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
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
need an explanation for this answer? contact us directly to get an explanation for this answer