Design 1:
#
##
###
####
#####
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf(“#”);
}
printf(“\n”);
}
getch();
}
Design 3:
1
00
111
0000
11111
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j,a;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
a=i%2;
printf(“%d”,a);
}
printf(“\n”);
}
getch();
}
Design 2:
*****
****
***
**
*
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j,a;
for(i=5;i>=1;i–)
{
for(j=1;j<=i;j++)
{
printf(“*”);
}
printf(“\n”);
}
getch();
}
Design 4:
1
10
101
1010
10101
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j,a;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
a=j%2;
printf(“%d”,a);
}
printf(“\n”);
}
getch();
}