As we have done the same program of a table using the "FOR LOOP" but we can also make that program using the "WHILE LOOP" it is also very easy and simple and the output of this program is same like we did in the "FOR LOOP" table program so I will not mention the output.
C Program:-
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int tbl,count=1;
printf("Enter the number which you want to print the table\n\n");
scanf("%d",&tbl);
while(count<=20)
{
printf("\n\n%2d X %2d= %3d",tbl,count,tbl*count);
count++;
}
getch();
}
C Program:-
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int tbl,count=1;
printf("Enter the number which you want to print the table\n\n");
scanf("%d",&tbl);
while(count<=20)
{
printf("\n\n%2d X %2d= %3d",tbl,count,tbl*count);
count++;
}
getch();
}
No comments:
Post a Comment