# Odd Pairs Codechef Solution

Hello coders, today we are going to solve the Odd Pairs Codechef Solution whose Problem Code is ODDPAIRS.

### Problem

Given an integer NN, determine the number of pairs (A, B) such that:

• 1 ≤ A, BN;
• A + B is odd.

### Input Format

• The first line of input will contain a single integer TT, denoting the number of test cases.
• Each test case consists of a single integer NN.

### Output Format

For each test case, output the number of required pairs.

Input

```5
1
2
3
100
199```

0
2
4
5000
19800

### Explanation:

Test case 1: There are no pairs satisfying the given conditions.

Test case 2: The pairs satisfying both conditions are: (1,2) and (2,1).

Test case 3: The pairs satisfying both conditions are: (1,2),(2,1),(2,3), and (3,2).

### Odd Pairs Codechef Solution in CPP

```#include <iostream>
using namespace std;
int main() {
int t,i;
cin>>t;
while(t--)
{
long int n,o=0,e=0,res;
cin>>n;
o=(n+1)/2;
e=n/2;
res=2*o*e;
cout<<res<<"\n";
}
return 0;
}
```

### Odd Pairs Codechef Solution in JAVA

```/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t>0){
long n = sc.nextLong();
System.out.println((n/2)*(n-(n/2))*2);
t--;
}
}
}
```

### Odd Pairs Codechef Solution in Python

```# cook your dish here
#odd pairs 2 (1,2) (2,1)   I.E N^2//2 METHODS ARE POSSIBLE
n = int(input())
while(n>0):
a = int(input())
print((a**2)//2)
n = n-1
```

Disclaimer: The above Problem (Odd Pairs) is generated by CodeChef but the solution is provided by Chase2learn.This tutorial is only for Educational and Learning purpose.

Sharing Is Caring