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;
}
You might also like to read:
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:
*****************************************/
Figure: Screen shot for Continuous Table C Program output |
You might also like to read:
Thanks, you helped me a lot. I finally got it.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete