Skip to content
Home » C Program to print Multiplication table using while loop

C Program to print Multiplication table using while loop

Learn about C Program to print Multiplication table using 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.

C Program to print Multiplication table using while loop

The C code for the multiplication table using a while loop is shown below. The while loop is a pre-test loop in which the condition is verified first and only the while loop statements are executed if the condition is true.

Source code:

 #include<stdio.h>
 int main()
 {
      int num, i=1;

      printf("Enter a number: ");
      scanf("%d",&num);

      while (i<=10)
      {
        printf(" %d * %d = %d\n", num, i, num*i);
        i++;
      }

      return 0;
 }

Output:

Enter a number: 6
 6 * 1 = 6
 6 * 2 = 12
 6 * 3 = 18
 6 * 4 = 24
 6 * 5 = 30
 6 * 6 = 36
 6 * 7 = 42
 6 * 8 = 48
 6 * 9 = 54
 6 * 10 = 60

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 for Multiplication table
C Program to Find Factors of a Number using recursion