1#include <iostream>
2using namespace std;
3int main()
4{
5 int n;
6 cin >> n;
7 for (int i = n; i >= 1; i++)
8 {
9 for (int j = 1; j <= i; j++)
10 {
11 cout<<"*";
12 }
13 int space = 2*n -2*i;
14
15 for (int j = 1; j <= space; j++)
16 {
17 cout << " ";
18 }
19 for (int j = 1; j <= i; j++)
20 {
21 cout << "*";
22 }
23 cout<<endl;
24 }
25
26 return 0;
27}
1#include<bits/stdc++.h>
2using namespace std;
3int main()
4{
5 int n;
6 cin>>n;
7
8 for(int i=1;i<=n;i++)
9 {
10 for(int j=1;j<=i;j++){
11 cout<<"*";
12 }
13 int space=2*n-2*i;
14 for(int j =1;j<=space;j++)
15 {
16 cout<<" ";
17 }
18 for(int j =1;j<=i;j++)
19 {
20 cout<<"*";
21 }
22 cout<<endl;
23 }
24
25 for(int i=n;i>=1;i--)
26 {
27 for(int j=1;j<=i;j++){
28 cout<<"*";
29 }
30 int space=2*n-2*i;
31 for(int j =1;j<=space;j++)
32 {
33 cout<<" ";
34 }
35 for(int j=1;j<=i;j++)
36 {
37 cout<<"*";
38 }
39 cout<<endl;
40 }
41 return 0;
42}