Wednesday, September 30, 2009

Write a program to print tables in rows in C

WAP to print tables in 3 rows using for loop
prog:
#include"stdio.h"
#include"conio.h"
void main()
{
int i, j,k;
clrscr();
for(i=1, j=2, k=3; i>=10, j<=20, k<=30; i=i+1,  j=j+2, k=k+3)     /* U can now add l=4, m=5..*/
{
printf("\n\n%d\t%d\t%d ", i, j, k);              //\t= tab
}
getch();
}

output:
1    2     3
2    4     6
3    6     9
4    8     12
5    10   15
6    12   18
7    14   21
8    16   24
9    18   27
10  20   30

No comments:

Post a Comment