wap to input 10 numbers and print the sum and average of all the numbers .
Answers
Answered by
0
Answer:
The following steps are taken to make the program-
Declare the required variables.
use the while loop.
inside the loop, input the values and calculate the sum.
outside the loop, calculate the average.
finally, print the answer.
Program:
print("Enter 10 numbers")
i = 0 # to iterate the loop
s = 0 # intializing the value to 0 to calculate the sum
while i < 10:
n = int(input()) # taking input as integer
s = s + n # modifying the variable to calculate the sum after every input
i += 1 # incrementing the loop counter
avg = s / 10 # calculating the average of the values
print("The sum is = ",s)
print("The average is =",avg)
#answer with quality
#BAL
Step-by-step explanation:
mark as brainleast
Attachments:
Similar questions