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

Write a C-program to display table using for loop


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


53 . Write a C-program to display table using for loop
54 . Write a C-program to print a to z
55 . Write a C-program to print ASCII values of a to z
56 . Write a C-program to print ASCII values of A to Z
57 . Write a C-program to print ASCII values of Numbers
58 . Write a C-program to print 1 to 10 values using while loop
59 . Write a C-program to print 10 to 1 values using while loop
60 . Write a C-program to print 1 to n values using while loop
61 . Write a C-program to print even numbers using while loop
62 . Write a C-program to print even number or odd number based on the n value using while loop
63 . Write a C-program to print even number or odd number based on the n value using single while loop