This is C Program to Print a Table with While Loop. In this program the User asks to print a table with the use of while loop. While loop checks the condition at least once and after that it goes on. Three variables are declared to containing the value in it for condition falling. User asks to enter the value. Then using of while condition. While (a<=10) then c=b*a. and so on increment operator a++ and printing the result on the screen.
Problem Statement:
This is program where user print a table with the use of while condition.
- Declaring variable.
- Using While condition.
- Display result on the screen.
Here is source code of the C program where user print a table with the use of while condition. The C program is successfully compiled. The program output is also shown below.
#include<stdio.h>
void main()
{
int a=1,b,c;
clrscr();
printf("Enter Any Value : ");
scanf("%d",&b);
printf("Table of %d is : ",b);
while(a<=10)
{
c=b*a;
printf(" %d ",c);
a++;
}
getch();
}