Template by:
Free Blog Templates

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

Write programs to print Numerical & Symbolic Patterns using C

 WAP to print the following numerical patterns

1)
5 5 5 5 5
4 4 4 4
3 3 3
2 2
1
2)
!
!  !
!  !  !
!  !  !  !..upto n
3)
*
*  *
*  *  *
*  *  *  *.. upto n
4)
1
1  2
1  2  3
1  2  3  4..upto n
5)
1
2  2
3  3  3
4  4  4  4..upto n 
6)
             *
         *  *
     *  *  *
 *  *  *  *..upto n
7)
             1

         2  1

     3  2  1

 4  3  2  1..upto n
8)
             1

         2  2

     3  3  3

 4  4  4  4..upto n



Click here to see solutions

Write programs to print alphabatical patterns using C

1) WAP to print the following pattern
A
A B
A B C
A B C D
prog:
#include"stdio.h"
#include"conio.h"
void main()
{
char i, j;
clrscr();
for(i='A'; i<='D'; i++)
{
for(j='A'; j<=i; j++)
{
printf("%c ", j);
}
printf("\n ");
}
getch();
}