W.A.P. C++

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

Snehil Khanor's Binary Log
Showing posts with label pyramid. Show all posts
Showing posts with label pyramid. Show all posts

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. }

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. }

write a program to diaplay a pyramid as shown:


The output is displayed as follows:
1
22
333
4444
55555
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=1;j<=i;j++)
  9. cout<<i;
  10. cout<<"\n";
  11. }
  12. getch();
  13. }

write a program to diaplay a pyramid as shown:


The following output is displayed:
1
12
123
1234
12345
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=1;j<=i;j++)
  9. cout<<j;
  10. cout<<"\n";
  11. }
  12. getch();
  13. }

write a program to diaplay a pyramid as shown:


Following output is obtained:
****
***
**
*
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<=4;i++)
  7. { for(int j=4;j>=i;j--)
  8. cout<<"*";
  9. cout<<"\n";
  10. }
  11. getch();
  12. }

write a program to diaplay a pyramid as shown:


Following output is obtained:
*
**
***
****
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<=4;i++)
  7. { for(int j=1;j<=i;j++)
  8. cout<<"*";
  9. cout<<"\n";
  10. }
  11. getch();
  12. }

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



eXTReMe Tracker