// C++ program to print the series
// 2, 1, 4, 3, 6, 5, …. up to N terms
#include <iostream>
using namespace std;
// Function to print the series
void printPattern(int N)
for (int i = 1; i <= N; i++)
// Find and print the ith term
cout <<" "<<((i % 2 == 0) ? (i - 1) : (i + 1));
// Driver code
int main()
// Get the value of N
int N = 10;
// Print the Series
printPattern(N);
return 0;