You are given with a number ‘n’. You have to count the pair of two numbers a and b such that sum of two numbers are equal to n.

# You are given with a number ‘n’. You have to count the pair of two numbers a and b 
such that sum of two numbers are equal to n.

n=int(input()) lst=[]
for x in range(1,n): 
    lst.append(x)
count = 0 
for i in range(0, len(lst)): 
    for j in range(0, len(lst)): 
        if lst[i] + lst[j] == n: 
            count += 1
print(count)


About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext