Facebook
From SURAJ PATWA, 1 Month ago, written in C++.
Embed
Download Paste or View Raw
Hits: 139
  1. x        
  2. xx      
  3. xxx      
  4. xxxx      x
  5. xxxxxxxxxxxx
  6. xxxx      x
  7. xxx      
  8. xx      
  9. x    
  10.  
  11.  
  12. #include<iostream>
  13. using namespace std;
  14. int main(){
  15.     int n=9;
  16.     for(int i=0;i<n;i++){
  17.         for(int j=0;j<n;j++){
  18.             if(i<=i ||i>n/2 && j<n-i  || i==n/2 ){
  19.                 std::cout<<"x";
  20.             }
  21.             else{
  22.                 std::cout<<" ";
  23.             }
  24.         }
  25.         if(i==n/2){
  26.             std::cout<<"xxx";
  27.            
  28.         }
  29.         if(i==n/2-1 || i==n/2+1){
  30.             std::cout<<" x";
  31.         }
  32.         std::cout<<std::endl;
  33.     }
  34.    
  35.    
  36. }