Learn about C Program to print Multiplication table using do while loop in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
C Program to print Multiplication table using do while loop
The below program uses do-while loop to print the multiplication table in C.
Source code:
#include<stdio.h>
int main()
{
int num, i=1;
printf("Enter a number: ");
scanf("%d",&num);
do
{
printf(" %d * %d = %d\n", num, i, num*i);
i++;
} while (i<=10);
return 0;
}
Output:
Enter a number: 5 5 * 1 = 5 5 * 2 = 10 5 * 3 = 15 5 * 4 = 20 5 * 5 = 25 5 * 6 = 30 5 * 7 = 35 5 * 8 = 40 5 * 9 = 45 5 * 10 = 50
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
C Program to print Multiplication table using while loop
C Program for Multiplication table