arrow_forward همه ارسال‌ها

جزئیات ارسال کد#891

code_blocks
مسئله مربوطه: الماس (#35) arrow_outward
verified
وضعیت داوری نهایی: پذیرفته شد
terminal
زبان برنامه‌نویسی: C++
schedule
ارسال‌کننده و زمان:
Parsa Alizadeh (۱۰ ماه پیش)
descriptionsolution.cpp ۳۳ خط • ۴۳۸ بایت
1#include<bits/stdc++.h>
2using namespace std;
3
4int main()
5{
6 int number;
7 cin>>number;
8 for(int i=1;i<=number;i+=2)
9 {
10 for(int j=1;j<=(number-i)/2;j++)
11 {
12 cout<<" ";
13 }
14 for(int k=1;k<=i;k++)
15 {
16 cout<<"*";
17 }
18 cout<<"\n";
19 }
20 for(int i=number-2;i>=1;i-=2)
21 {
22 for(int j=1;j<=(number-i)/2;j++)
23 {
24 cout<<" ";
25 }
26 for(int k=1;k<=i;k++)
27 {
28 cout<<"*";
29 }
30 cout<<"\n";
31 }
32 return 0;
33}
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8