Using while loop
//C Program to prepare Table of any Number using while loop
#include
#include
void main()
{
int n,t,count=1;
clrscr();
printf("Enter any number\n\n");
scanf("%d",&n);
while(count<=10)
{
t=n*count;
printf("\n%d*%d=%d",n,count,t);
count++;
}
getch();
}
#include
#include
void main()
{
int n,t,count=1;
clrscr();
printf("Enter any number\n\n");
scanf("%d",&n);
while(count<=10)
{
t=n*count;
printf("\n%d*%d=%d",n,count,t);
count++;
}
getch();
}
Using for loop
//C Program to prepare Table of any Number using for loop
#include<stdio.h>
#include<conio.h>
void main()
{
int n,t,count;
clrscr();
printf("Enter any number\n\n");
scanf("%d",&n);
for(count=1;count<=10;count++)
{
t=n*count;
printf("\n%d*%d=%d",n,count,t);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int n,t,count;
clrscr();
printf("Enter any number\n\n");
scanf("%d",&n);
for(count=1;count<=10;count++)
{
t=n*count;
printf("\n%d*%d=%d",n,count,t);
}
getch();
}
Hope you liked my posts, give comments if you have any doubts.. :)
Categories:
c program
0 comments:
Post a Comment