CodeSolved

A comprehensive source of programming questions and exercises

Average numbers (infinite)

Practice Easy 24/ Download 3869 Views

Write a program that can obtain the average infinite number of numbers:

The program must first get the user's numbers (as long as the user has not entered the number 0, taking the numbers must continue)

Next step must be calculated and printed the mean numbers received and printed

22 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
num=int(input("enter a number: "))
sum=0
count=0
while(num!=0):
    sum+=num
    count+=1 
    num=int(input("enter a number: "))
print("avg: ",sum/count)
Saeeda33 Download Python
s = 0
a = 0

while True  :
    j = int(input("number: "))
    if j == 0:
        break
    s += j
    a += 1

print ("avg:",s/a)
Arsam Download Python
print(" salam ; baray etmam add giri add  0  ra vared kon ta mieangin ro bede")
mieangin = 0
j = 1
a = float(input("add {} :      ".format(j)))
while a != 0 :
    mieangin = a / j
    j = j + 1
    a = float(input("add {} :      ".format(j)))
    mieangin = (mieangin + a) / j
else:
    print(mieangin)
User 3026 Download Python
s=0
while 1:
 num= int(input('num:'))
 if num==0:
  break
 s+=num
print(s)
Maryam.n Download Python
numbers = []

while True:
    g = int(input("enter a number:"))
    if g == 0:
        break
    numbers.append(g)
print (sum(numbers) / len (numbers))
User 558 Download Python
an = 0
te = 0 
while True:
    print("برای وارد کردن نمره عدد 1 را وارد کن")
    print("برای میانگین گرفتن عدد 2")
    a = int(input("gozineye morede nazar ro vared kon : "))
    if a == 1 :
        x = float(input("nomarateto darj kon: "))
        an += x
        te += 1 
        continue
    if a == 2 :
        if te == 0:
            print("meghdari vared nashodeh ast dobare talash konid")
            continue
    if a == 2 :
        print(f"miyangin nomarat: {an / te}")
    if a != 1:
        if a != 2:
            print(f"{a} رو از کجاست بیرون کشیدی یابووووو دو گزینه بیشتره مگه!!!")
Azhgun Download Python
a = 0
b = 0
while True:
    x = int(input('Enter number: '))
    if x == 0:
        break
    else:
        a += x
        b +=1
print(a/b)
<< Previous page 1 2 3 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close