forked from AllAlgorithms/cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbshuffll.cpp
More file actions
41 lines (37 loc) · 716 Bytes
/
bshuffll.cpp
File metadata and controls
41 lines (37 loc) · 716 Bytes
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
//
// Bshuffll Implementation
//
// The All ▲lgorithms Project
//
// https://allalgorithms.com/
// https://github.com/allalgorithms/cpp
//
// Contributed by: shashank3395
// Github: @shashank3395
//
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if(n==1)
{ cout<<1<<"\n"<<1;}
else if(n%2==0)
{
for(int i=1;i<=n;i++)
cout<<i<<" ";
cout<<"\n";
for(int i=n;i>=1;i--)
cout<<i<<" ";
}
else if(n%2==1)
{
for(int i=1;i<=n;i++)
cout<<i<<" ";
cout<<"\n";
for(int i=n;i>=1;i--)
cout<<i<<" ";
}
}