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.
1 Antwort
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.