February 4, 2011

C Program to prepare Table of any Number


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();
}


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();
}


Hope you liked my posts, give comments if you have any doubts.. :)

Related Posts :



Categories:

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Related Posts with Thumbnails