Advertisement
Abelsor

S4_Ejercicio_7

Mar 1st, 2023
571
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. // Rombo
  2.  
  3. #include<iostream>
  4.  
  5. using namespace std;
  6.  
  7. void t_diamante(int);
  8.  
  9. int main()
  10. {   int n;
  11.     cin>>n;
  12.    
  13.     t_diamante(n);
  14.    
  15.    
  16. }
  17.  
  18. #include<iostream>
  19. using namespace std;
  20.  
  21. void t_diamante(int n){
  22.     for(int i=1 ; i<=n ; i++){
  23.         for(int j=n-i ; j>0 ; j--){
  24.             cout<<"-";
  25.         }
  26.         for(int j=0 ; j<2*i-1 ; j++){
  27.             cout<<"*";
  28.         }
  29.         cout<<endl;
  30.     }
  31.    
  32.     for(int i=1 ; i<n ; i++){
  33.         for(int j=0 ; j<i ; j++){
  34.             cout<<"-";
  35.         }
  36.         for(int j=0 ; j<2*(n-i)-1 ; j++){
  37.             cout<<"*";
  38.         }
  39.         cout<<endl;
  40.     }
  41.    
  42.    
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement