want the solution of above question?
summ = 0
count = 1
while raw_input("Enter q to quit or any other key to continue") != 'q':
summ = summ+input()
count=count+1
print summ/(count*1.0)
import random # Some random Shenanigans # Ignore to Initialization for answer def comp_input(): return comp_input(random.randchoice[random.randint(1, 100), random.randint(1, 100), ‘q’]) # Initialization count = 0 sum = 0 product = 1 # Loop will run infinitely till user presses 'q' while True: # Uncomment user_input = comp_input, Comment user_input = input(...) for magic # user_input = comp_input user_input = input('Enter a number: ') if user_input == ‘q’: break user_input = int(user_input) # Store the result of addition of prev sum and user input sum = sum + user_input # Store the result of addition of prev sum and user input product = product * user_input # Count the number of times user gave integer input count = count + 1 print('Average:', sum/count) print('Product:', product)
more = "n"
sum = 0
False = "q"
count = 0
product = 1
while more == "n":
count = count +1
x = float(raw_input("Enter Number"))
sum = (sum + x)
product = x*product
print "Press q when you are done inputting the numbers or n to continue"
more = raw_input("")
c = sum/count
print "You Inputed", count, "Numbers"
print "The Average of the Numbers is ", c
print "The product of the numbers is ", product
#Code written by Onasanya Tunde
#fb.com/onasanyatunde on facebook
print("Start entering numbers")
sum=0
c=0
while 1:
num=int(input())
c=c+1
sum=sum+num
print("Press q when you are done inputting the numbers or y to continue")
m=input()
if m=='q':
break
print("Average",sum/c)
print("Sum",sum)
Hey guys,
Check out the solution, please let me know if any correction in this program :)
#Code
i=0
a=100
n=0
while i <= a:
print('Enter the input')
user_input=str(input())
if user_input!='q':
n=n+int(user_input)
print('Enter to continue or q to quit')
i=i+1
else:
print('You have chosen to quit')
break
avg=n/i
print("total time the user entered the value is : %d " %i)
print("Average : %d" %avg)
print("product of all the number : %d" %n)
And the output will be like the below:
Enter the input
10
Enter to continue or q to quit
Enter the input
10
Enter to continue or q to quit
Enter the input
20
Enter to continue or q to quit
Enter the input
q
You have chosen to quit
total time the user entered the value is : 3
Average : 13
product of all the number : 40
Thank you!!!
#include using namespace std;
int main(){
char c;
int sum=0;
int i=1;
int prod=1,avg;
while(c != 'q'){
int n;
cout<<"Enter the input : ";
cin>>n;
sum +=n; avg = sum /i;
i++;
prod *= n;
cout<<"Enter the q to quit and continue c :";
cin>>c;
if(c=='q'){ break; }
}
cout<<"Average is : "<<avg<<endl;
cout<<"Product is : "<<prod<<endl;
return 0;
}
using namespace std;
#include int main(){
int n,a,m;
m=1;
a=0;
char b;
for(int i=1;i>=1;i++) {
cout << "enter a number"<<endl;
cin>>n;
m = m * n;
a = a + n;
cout << "to exit press q else n"<<endl;
cin>> b;
if (b =='q') {
break; }
else if (b =='n'){
continue; }
}
cout<<"product is "<<m;
cout<<"the sum is "<<a;
return 0;
}
Thanks for the very good answers that helped me gain new knowledge from this topic geometry dash lite
I realize this is one of the most meaningful counsel for me. And i am vivacious studying your article. however have to commentary upon some standard matters, the internet site style is unmodified; the articles are invincible. thank you for the ton of actual and viable explicit. Food Photography Denpasar Bali
IDM crack is a https://allpcworld.site/ program that modifies temporarily or permanently an application to eliminate limitations imposed on them originally. The crack version makes ...
I find the information you give both interesting and helpful, so I read it often io games unblocked