ardiansyahiswan

BIntangf

Mar 31st, 2019
771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main (){
  4. int a,b,c=5;
  5. for (a=1;a<=5;a++) {
  6. for (b=1;b<=a;b++) {
  7. cout <<"*";
  8. }
  9. cout << endl;
  10. }
  11. for (a=2;a<=5;a++) {
  12. for (b=a;b<=5;b++) {
  13. cout << "*";
  14. }
  15. cout << endl;
  16. }
  17.  
  18. cout<<endl;
  19.  
  20. for (a=1;a<5;a++){
  21. for(b=1;b<=5;b++){
  22. cout<<"*"<<" ";
  23. }
  24. cout<<endl;
  25. }
  26.  
  27. cout<<endl;
  28.  
  29.  
  30. for(a=5;a>=1;a--){
  31. for(b=a;b>1;b--){
  32. if (a==c||b==a)
  33. cout<<"*"<<" ";
  34. else
  35. cout<<" ";
  36. }
  37. for(b=1;b<=c-a+1;b++){
  38. if(a==1||b==c-a+1)
  39. cout<<"*"<<" ";
  40. else
  41. cout<<" ";
  42. }
  43. cout<<endl;
  44. }
  45. cout<<endl;
  46.  
  47. for(a=1;a<=5;a++){
  48. for(b=1;b<=5;b++){
  49. if (a==3||b==1||b==5){
  50. cout<<"*";
  51. }
  52. else {
  53. cout<<" ";
  54. }
  55. }
  56. cout<<endl;
  57. }
  58. cout<<endl;
  59. for(a=1;a<=5;a++){
  60. for(b=1;b<=5;b++){
  61. if (a==3||b==1||a==1){
  62. cout<<"*";
  63. }
  64. else {
  65. cout<<" ";
  66. }
  67. }
  68. cout<<endl;
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment