Making Pyramid with C/C++
#include<stdio.h>
#include<conio.h>
void main()
{
int i = 0, j , n ;
clrscr();
printf("How many rows in pyramid:");
scanf("%d",&n);
while(i<n)
{
j=0;
while(j<=i)
{
gotoxy(30+j,10+i);
printf("%d",j);
j++;
}
j=0;
while(j<=i)
{
gotoxy(30-j,10+i);
printf("%d",j);
j++;
}
i++;
printf("\n");
}
getch();
}
Remarks
For making two sides pyramid we have used two while loops and another while loop for controlling rows. Here gotoxy () function takes the curser to the specified location.
shotmix error, smile here
ReplyDeleteTHank You. Hello, I visit and give your full support and please support me back. Thank you in advance.
ReplyDelete