X pyramid

Program to display X Pyramid Structure




#include <iostream.h>

#include <conio.h>

int main()

{

for (int i=1; i<=40;i+=2)

{

for (int x=40;x>=i;x--)

{

cout<<" ";

}

for (int j=1;j<=i;j++)
          
{
       
cout<<"X";

cout<<" ";  

}         

cout<<endl;

}

getch();

return 0;

}

No comments :

Post a Comment