Advertisement
dzieciol

kwadrat z przekątną

Oct 12th, 2014
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  4.  using namespace std;
  5. int main(int argc, char** argv) {
  6.     int a,x,k;
  7.     cin>>a;
  8.     for (int i =1 ; i<=a;i++)
  9.     cout<<"#";
  10.     cout<<endl;
  11.     k=-1;
  12.     for (int i=1;i<=a-2;i++){
  13.    
  14.         k++;
  15.             cout<<"#";
  16.         for (int j=0 ;(j<k);j++)
  17.    
  18.         cout<<" ";
  19.         cout<<"#";
  20.    
  21.         for (x=1;x<=a-k-3;x++)
  22.         cout<<" ";
  23.         cout<<"#"<<endl;}
  24.         for (int j=0;j<a;j++)
  25.         cout<<"#";
  26.        
  27.        
  28.    
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement