-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path118B.cpp
43 lines (42 loc) · 826 Bytes
/
118B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int count=0;
for(int i=0;i<=n;i++)
{
for(int s=n-i;s>0;s--)
cout<<" "<<" ";
cout<<0;
for(int j=1;j<=i;j++)
{
cout<<" "<<j;
}
if(i!=0)
cout<<" "<<i-1;
for(int k=i-2;k>=0;k--)
{
cout<<" "<<k;
}
cout<<endl;
}
for(int i=0;i<n;i++)
{
for(int s=i;s>=0;s--)
cout<<" "<<" ";
cout<<0;
for(int j=1;j<=n-i-1;j++)
{
cout<<" "<<j;
}
if(n-i-2>=0)
cout<<" "<<n-i-2;
for(int k=n-i-3;k>=0;k--)
{
cout<<" "<<k;
}
cout<<endl;
}
}