0

I have to add n numbers. code that it will first ask how many input you want to take. And then it will take all n input to add.

Python 3 coding

7th Dec 2021, 7:04 PM
Abhinav Anand
2 Respostas
0
sum,a=0,int(input('how many num u got:')) for i in range(a):sum+=float(input('enter the num: ')) print(sum)
7th Dec 2021, 9:19 PM
Amirreza
Amirreza - avatar
+ 5
You could approach the task like this: * create a variable s for sum, that has the value 0 * take input n using the input() function * convert n to an integer using int() * use a for-loop to get n inputs * covert the inputs to integer and add them to s * output s using print() after the loop if you already have a code, please show it so we can help you
7th Dec 2021, 7:18 PM
Lisa
Lisa - avatar