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

Write a C-program to display table using while loop


#include <stdio.h>
int main() {
    int x=1,n;
    printf("Enter n value ");
    scanf("%d",&n);
    while(x<=10)
    {
         printf("\n %d * %d = %d",x,n ,x*n);
         x++;
    }
    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


72 . Write a C-program to display table using while loop
73 . Write a C-program to print a to z using while loop
74 . Write a C-program to print ASCII values of a to z using while loop
75 . Write a C-program to print ASCII values of A to Z using while loop
76 . Write a C-program to print ASCII values of Numbers using while loop
77 . Write a C-program to print 1 to 10 values using do while loop
78 . Write a C-program to print 10 to 1 values using do while loop
79 . Write a C-program to print 1 to n values using do while loop
80 . Write a C-program to print even numbers using do while loop
81 . Write a C-program to print even number or odd number based on the n value using do while loop
82 . Write a C-program to print even number or odd number based on the n value using single do while loop