Write a program to print these Floyd’s triangle
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,m;
clrscr();
scanf("%d",&m);
printf("\n\n\n");
for(a=1;a<=m;a++)
{
for(b=1;b<=a;b++)
if(a%2!=0)
if(b%2!=0)
printf("1 ");
else
printf("0 ");
else
if(b%2!=0)
printf("0 ");
else
printf("1 ");
printf("\n");
}
getch();
}
#include<conio.h>
main()
{
int a,b,m;
clrscr();
scanf("%d",&m);
printf("\n\n\n");
for(a=1;a<=m;a++)
{
for(b=1;b<=a;b++)
if(a%2!=0)
if(b%2!=0)
printf("1 ");
else
printf("0 ");
else
if(b%2!=0)
printf("0 ");
else
printf("1 ");
printf("\n");
}
getch();
}