Write a C-program to display table using do while loop?

Write a C-program to display table using do while loop


#include <stdio.h>
int main() {
    int x=1,n;
    printf("Enter n value ");
    scanf("%d",&n);
    do
    {
         printf("\n %d * %d = %d",x,n ,x*n);
         x++;
    }while(x<=10);
    return 0;
}

Output:

Enter n value 2

1 * 2 = 2
2 * 2 = 4
3 * 2 = 6
4 * 2 = 8
5 * 2 = 10
6 * 2 = 12
7 * 2 = 14
8 * 2 = 16
9 * 2 = 18
10 * 2 = 20


Enter n value 5

1 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50




More Programs


91 . Write a C-program to display table using do while loop
92 . Write a C-program to print a to z using do while loop
93 . Write a C-program to print ASCII values of a to z using do while loop
94 . Write a C-program to print ASCII values of A to Z using do while loop
95 . Write a C-program to print ASCII values of Numbers using do while loop