- 【例37.3】 菱形图形
q
- 2025-1-14 14:55:25 @
#include<bits/stdc++.h>
using namespace std;
int main() {
int n,n1=1;
cin >> n;
for(int i=1; i<=n; i++){
for(int y=1; y<=n-i; y++){
cout << " ";
}
for(int j=1; j<=2*i-1; j++){
cout << n1;
n1++;
}
cout << endl;
n1=1;
}
for(int i=n-1; i>=1; i--){
for(int y=1; y<=n-i; y++){
cout << " ";
}
for(int j=1; j<=2*i-1; j++){
cout << n1;
n1++;
}
cout << endl;
n1=1;
}
return 0;
}
0 comments
No comments so far...
Information
- ID
- 139
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 8
- Tags
- # Submissions
- 96
- Accepted
- 18
- Uploaded By