In this article we will print the table of any given number. first of all we will take input a number from the user and using for loop we will print the table.
In the following program firt of all we have declared a variable x in which we will take a number from the user. i variable will be used in for loop.
//print table using for loop
#include<stdio.h>
void main()
{
int x,i;
printf("Enter value ");
scanf("%d",&x);
for(i=1; i<=10; i++)
{
printf("%d*%i=%d",x,i,x*i);
printf("\n");
}
}
Figure 1
Figure 2