0

N=int(input('Enter number')) sum = 0 i=1 while i<=N: sum=sum+i i=i+2 print(sum)

can anyone explain it.

4th Oct 2018, 8:24 AM
Nick Fiction
Nick Fiction - avatar
1 ответ
0
Hi Nick, The above code is returning the sum of odd numbers within the range starting from 1 to N, where N is the user input and we are typecasting it to integer type since by default input function returns a string type.
27th Sep 2022, 8:44 PM
Bhuvana Karthigeyan
Bhuvana Karthigeyan - avatar