Advertisement
Qlynx

PIRAMID ANGKA

Oct 22nd, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void cetakPiramid(int tinggi){
  5.     //Prosedur
  6.     int k;
  7.     for (int i=1;i<=tinggi; i++){
  8.         for(int j=tinggi;j>=i; j--){
  9.         cout << " ";
  10.         }
  11.         for (int j=i;j<(2*i);j++){
  12.         cout << j; 
  13.     }
  14.         for (int j=2*(i-1);j>=i;j--){
  15.         cout << j;
  16.     }
  17.         cout << endl;
  18.     }
  19. }
  20.  
  21. int main (){
  22.     int t;
  23.     cout << "Tinggi Piramid = ";
  24.     cin >> t;
  25.     cetakPiramid (t);
  26.    
  27.    
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement