W.A.P. C++

WAP | CPP | Programs in C++ | C++ Solutions

Snehil Khanor's Binary Log

write a program to diaplay a pyramid as shown:


The following output is obtained:
    1
   212
  32123
 4321234
543212345
543212345
 4321234
  32123
   212
    1
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. {
  8. for(int j=4;j>=i;j--)
  9. cout<<" ";
  10. for(int k=1;k<=i;k++)
  11. cout<<k;
  12. for(k=i-1;k>=1;k--)
  13. cout<<k;
  14. cout<<"\n";
  15. }
  16. for (i=5;i>=1;i--)
  17. {
  18. for(int j=4;j>=i;j--)
  19. //Coding by: Snehil Khanor
  20. //http://WapCPP.blogspot.com
  21. cout<<" ";
  22. for(int k=1;k<=i;k++)
  23. cout<<k;
  24. for(k=i-1;k>=1;k--)
  25. cout<<k;
  26. cout<<"\n";
  27. }
  28. getch();
  29. }

0 comments:

Search

About WAP C++

Here you'll find a wide range of programs' solution ranging from beginer level to advanced level.
All programs here are made, compiled and tested by me..and are running absolutely fine.. still if you find any bug in any program do let me know :)

Followers

Subscribe via email

Enter your email address:

Delivered by FeedBurner

my Binary Log

Blog Archive



eXTReMe Tracker