Integer – Count of Pairs

The program must an integer N as the input. The program must print the count C of pairs of positive integers X and Y so that the sum of X and Y is equal to N.

Input :

6

Output :

5

Explanation:
All possible pairs of integers whose sum is equal to 6 are (1, 5), (2, 4), (3, 3), (4, 2) and (5, 1).
Here the count of pairs of integers is 5, so 5 is printed as the output.

Here are the various methods and logic’s.

Python:

//Python Logic by Agent Loki
n=int(input())
print(n-1)
//Python Logic by Agent Stark
print(int(input())-1)

Leave a Reply

Your email address will not be published. Required fields are marked *

More posts. You may also be interested in.