File tree Expand file tree Collapse file tree 1 file changed +27
-51
lines changed Expand file tree Collapse file tree 1 file changed +27
-51
lines changed Original file line number Diff line number Diff line change 1- //  $        $
2- //  $$      $$
3- //  $$$    $$$
4- //  $$$$  $$$$
5- //  $$$$$$$$$$
6- //  $$$$$$$$$$
7- //  $$$$  $$$$
8- //  $$$    $$$
9- //  $        $
101
11- #include   < bits/stdc++.h > 
2+ #include < iostream > 
123using  namespace  std ; 
13- typedef  long  long  ll;
144
15- int  main (void )
5+ int  main ()
166{
17-     int  n;
18-     cin >> n;
19-     for  (int  i = n - 1 ; i >= 0 ; i--)
20-     {
21-         for  (int  j = n - 1 ; j >= i; j--)
22-         {
23-             cout << " $" 
24-         }
25-         for  (int  j = 0 ; j < 2  * i; j++)
26-         {
27-             cout << "  " 
28-         }
29-         for  (int  j = n - 1 ; j >= i; j--)
30-         {
31-             cout << " $" 
32-         }
33-         cout << endl;
34-     }
35-     for  (int  i = 0 ; i < n; i++)
36-     {
37-         for  (int  j = n - 1 ; j >= i; j--)
38-         {
39-             cout << " $" 
40-         }
41-         for  (int  j = 0 ; j < 2  * i; j++)
42-         {
43-             cout << "  " 
44-         }
45-         for  (int  j = n - 1 ; j >= i; j--)
46-         {
47-             cout << " $" 
48-         }
49-         cout << endl;
50-     }
7+   int  r,i,j;
8+   cout<<" Enter no. of rows: " 
9+   cin>>r;
10+   
11+   for (i=1 ;i<=r;i++)
12+   {
13+     for (j=1 ;j<=i;j++)
14+     cout<<" *" 
15+     for (j=1 ;j<=2 *(r-i);j++)
16+     cout<<"  " 
17+     for (j=1 ;j<=i;j++)
18+     cout<<" *" 
19+     cout<<" \n " 
20+   }
21+     for (i=r;i>=1 ;i--)
22+   {
23+     for (j=1 ;j<=i;j++)
24+     cout<<" *" 
25+     for (j=1 ;j<=2 *(r-i);j++)
26+     cout<<"  " 
27+     for (j=1 ;j<=i;j++)
28+     cout<<" *" 
29+     cout<<" \n " 
30+   }
31+   return  0 ;
5132}
52- 
53- //  0123
54- //  @  @ 0
55- //  @@
56- //  @@@@@@ 1
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments