write a program to diaplay a pyramid as shown:

Following output is displayed:

    1

   212

  32123

 4321234

543212345



Select To use this code as it is.. select and copy paste this code into code.cpp file :)



  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. for (int i=1;i<=5;i++)
  7. //Coding by: Snehil Khanor
  8. //http://WapCPP.blogspot.com
  9. {
  10. for(int j=4;j>=i;j--)
  11. cout<<" ";
  12. for(int k=1;k<=i;k++)
  13. cout<<k;
  14. for(k=i-1;k>=1;k--)
  15. cout<<k;
  16. cout<<"\n";
  17. }
  18. getch();
  19. }

Check out this stream