#include<stdio.h>
#include<conio.h>
void main()
{
int num,i,j,k,l,x=1;
X: clrscr();
printf("\n\n Enter the number of level u wanna print in this pyramind (Max. 33):");
scanf("%d",&num);
if(num>33)
{ goto X; }
printf("\n\n The Following Pyramind is : \n\n");
for(i=1;i<=num;i++)
{
k = num-i;
for(j=1;j<=k;j++)
{ printf(" "); }
for(l=1;l<=i;l++)
{
printf("%d ",x%2);
x++;
}
for(j=1;j<=k+2;j++)
{ printf(" "); }
printf(" LEVEL:%d \n",k+1);
}
getch();
}
#include<conio.h>
void main()
{
int num,i,j,k,l,x=1;
X: clrscr();
printf("\n\n Enter the number of level u wanna print in this pyramind (Max. 33):");
scanf("%d",&num);
if(num>33)
{ goto X; }
printf("\n\n The Following Pyramind is : \n\n");
for(i=1;i<=num;i++)
{
k = num-i;
for(j=1;j<=k;j++)
{ printf(" "); }
for(l=1;l<=i;l++)
{
printf("%d ",x%2);
x++;
}
for(j=1;j<=k+2;j++)
{ printf(" "); }
printf(" LEVEL:%d \n",k+1);
}
getch();
}
No comments:
Post a Comment