Sunday 20 May 2012

Write a program to generate table of number using while loop


/*program to generate table of any number entered through the key board using while loop*/
void main()
{
int a,b,c;
clrscr();
printf("Enter any number for its multiplication table ");
scanf("%d",&a);
b=1;
while(b<=10)
{
c=a*b;
printf("\n%d\t*\t%d\t=\t%d",a,b,c);
b++;
}}
Output
Enter any number for its multiplication table 5

5   *     1        =       5
5   *     2        =       10
5   *     3        =       15
5   *     4        =       20
5   *     5        =       25
5   *     6        =       30
5   *     7        =       35
5   *     8        =       40
5   *     9        =       45
        5   *   10      =       50

1 comment:

  1. Appreciation for nice Updates, I found something new and folks can get useful info about BEST ONLINE TRAINING

    ReplyDelete