5.15.2016

Continuous Table C Program

Q. how to make a continuous table for all number in C language like as following:

     1 2 3  4  5
     2 4 6  8  10
     3 6 9  12 15
     4 8 12 15 20

Ans.

/* c program to make a continuous table c program */

#include<stdio.h>
int main()
{
 int n,num,r,c,p;
 printf("Enter No. of loop : ");   
 scanf("%d", &num);
 printf("Enter last table No. : ");
 scanf("%d", &n);
 for(r=1; r<=n; r++)
    printf(" %d",r);
 printf("\n");
 for(r=2; r<=num; r++)
 {
    for(c=1,p=r; c<=n; c++,p=r*c)
       printf(" %d",p);
    printf("\n");
 }
 getch();
 return 0;
}


/****************************************
The output of above program would be:
*****************************************/
Output of Continuous Table C Program
Figure: Screen shot for Continuous Table C Program output

You might also like to read:

  1. Big list of 98+ C pyramid programs
  2. Latest user asking pyramid program list

2 comments:

  1. Thanks, you helped me a lot. I finally got it.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete