How to write a C Program to print table vertically in C Programming Language ?
Solution:
#include<stdio.h> #include<conio.h> void main() { int i,j,a,result=0; clrscr(); printf("Enter the number up to which you want to print table==>"); scanf("%d",&a); printf("Table till the %d is===>\n",a); for(i=1;i<=10;i++) { for(j=1;j<=a;j++) { result=i*j; printf("%d\t",result); } printf("\n"); } getch(); }
OUTPUT :
Enter the number up to which you want to print table==>5
Table till the 5 is===>
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
6 12 18 24 30
7 14 21 28 35
8 16 24 32 40
9 18 27 36 45
10 20 30 40 50