MADODDSUM - Easy Odd Sum

Hablu likes odd numbers a lot. So he wants the sum of all odd numbers in range [a, b]. That is, find the sum of all odd numbers i such that (a ≤ i ≤ b). Seems easy right? Because it is.


The first and only line will contain 2 integers a, b where (0 ≤ a ≤ 108) and (0 ≤ b ≤ 108).


In one line, output the value of the sum


0 9


hide comments
abhi31273: 2019-02-28 06:19:34


Last edit: 2019-02-28 06:20:16
karankeswani99: 2018-12-19 10:29:59

very simple!!!

arunsriram1155: 2018-08-22 07:11:39

yes the range should be (a,b]. the question is wrong ...please change it

syfe: 2018-04-13 17:29:30

My output is exactly same but it's showing wrong answer.
Can anyone please help?

nadstratosfer: 2018-03-16 18:08:02

vedranab: Nothing, your approach is.

vedranab: 2018-03-16 10:17:20

What is wrong with programming in Phyton?

jovice786: 2017-12-23 07:31:29

dont forget to look at range ,a nd b can be even too and u have to make them odd and use simple ap formula for summation and dont forger unsigned long long int

namanruhela03: 2017-12-14 16:07:54

It seems like an easy one but I can't get it right. I either get compilation error or wrong answer. Can someone help with where I can look for help?

shubham9261: 2017-07-30 22:52:38

just a minor mistake
cost me 2 wa's

Last edit: 2017-07-30 22:56:23
trollkarlnet: 2017-04-19 07:27:16

unsigned long long was my solution :|

Added by:Ruhan Habib
Time limit:0.5s-1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY