Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Odd number sum in python

for tc in range(int(input())):
    a,b = map(int,input().split())
    x =  b//2 + (b%2)
    y =  a//2
    print("Case %d: %d"%(tc+1,x*x-y*y))
    
"""
Input:
2
1 10
2 10
Output:
Case 1: 25
Case 2: 24
"""
Source by toph.co #
 
PREVIOUS NEXT
Tagged: #Odd #number #sum #python
ADD COMMENT
Topic
Name
6+5 =