Saturday, July 23, 2011

A C program that can print Table of any number

This is very important and basic program and we can make a table both with the help of for loop of with the help of while loop. This is the coding of this C language Program.

C Program:-



#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int tbl,count;
printf("Enter the number which you want to print the table=\n\n");
scanf("%d",&tbl);
for(count=1;count<=5;count++)
printf("\n\n%2d   X   %2d= %3d",tbl,count,tbl*count);
getch();
}

OUTPUT:-

Enter the number which you want to print the table= 5

 5  X  1= 5
 5  X  2=10
 5  X  3=15
 5  X  4=20
 5  X  5=25

Note:-
           In this program we first of all takes an input from the user that which number he want to make the table of and the we use a for loop and starts it from one and end it any number (number at which you want to print table) and then simply print it line by line in body of for loop and makes  the formula of finding it.

No comments:

Post a Comment