/* Pattern 3:
0
1 0
0 1 0
1 0 1 0
0 1 0 1 0 */
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y;
clrscr();
for(x=1;x<=5;x++)
{
for(y=x;y>=1;y--)
{
if(y%2==1)
printf("0 ");
else
printf("1 ");
}
printf("\n");
}
getch();
}
//Now one can try to print the following patterns
/* Pattern 4:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Pattern 5: FLOYD'S TRIANGLE
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
*/
No comments:
Post a Comment