#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
int center_x=n/2,center_y=n/2;
for(int i=0;i<n;i++){
for (int j = 0; j < n; j ++ ){
if(abs(i-center_x)+abs(j-center_y)<=n/2)
cout<<"*";
else cout << " ";
}
cout <<endl;
}
return 0;
}
输入n打印菱形
最新推荐文章于 2024-10-16 00:00:43 发布