Ask the user how many numbers for which they want to calculate the sum. Using a for loop, prompt the user to enter that many numbers, one-by-one, keeping track of the sum. At the end, after the user entered all numbers, output the sum.

Answers

Answer 1

n = int(input("How many numbers do you want to sum? "))

total = 0

for x in range(n):

   total += int(input("Enter a number: "))

print("Sum: "+str(total))

I hope this helps!

Answer 2

Following are the program to the given question:

Program Explanation:

Defining a variable "Sum" that holds an integer value.In the next step, a variable "t" is defined that uses the input method to input a value from the user-end.After the input value, a for loop is declared that takes the range of the t variable.Inside the loop, another variable "n" is defined that inputs value from user-end and use the "Sum" variable to add its value.Outside the loop, a print method has been used that prints the sum variable in the string with the message.  

Program:

Sum = 0#defining a variable sum that hold an integer value

t= int(input("Enter the total number you want to add: "))#defining a t variable that input value from user-end

for i in range(t):#defining a loop that add inputs values from above user-input range

   n= int(input("Enter value "+str(i+1)+": "))#defining loop that inputs n value

   Sum += n; #defining sum variable that adds user-input value

print("Sum of entered number: "+str(Sum))#using print method that print added value

Output:

Please find the attached file.

Learn more:

brainly.com/question/16025032

Ask The User How Many Numbers For Which They Want To Calculate The Sum. Using A For Loop, Prompt The

Related Questions

Write a function named findmax()that finds and displays the maximum values in a two dimensional array of integers. The array should be declared as a 10 row by 15 column array of integers in main()and populated with random numbers between 0 and 100.

Answers

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Random r = new Random();

    int[][] numbers = new int[10][15];

   

    for (int i=0; i<10; i++){

        for (int j=0; j<15; j++){

            numbers[i][j] = new Random().nextInt(101);

        }

    }

   

    for (int i=0; i<10; i++){

        for (int j=0; j<15; j++){

            System.out.print(numbers[i][j] + " ");

        }

        System.out.println();

    }

   

    findmax(numbers);

}

public static void findmax(int[][] numbers){

    int max = numbers[0][0];

   

    for (int i=0; i<10; i++){

        for (int j=0; j<15; j++){

            if(numbers[i][j] > max)

                max = numbers[i][j];

        }

    }

    System.out.println("The max is " + max);

}

}

Explanation:

*The code is in Java.

Create a function called findmax() that takes one parameter, numbers array

Inside the function:

Initialize the max as first number in the array

Create a nested for loop that iterates through the array. Inside the second for loop, check if a number is greater than the max. If it is set it as the new max

When the loop is done, print the max

Inside the main:

Initialize a 2D array called numbers

Create a nested for loop that sets the random numbers to the numbers array. Note that to generate random integers, nextInt() function in the Random class is used

Create another nested for loop that displays the content of the numbers array

Call the findmax() function passing the numbers array as a parameter

Are Dogs are better than video games?

Answers

sometimes bc dogs are very lovey but video games also have there moments

Answer:

In some cases yes.

Explanation:

Some days I really enjoy my video games and other days I enjoy being with my dog but sometimes they are annoying especially if they have way more energy than you

An uniterruptible power supply

Answers

Answer:

An uninterruptible power supply  is an electrical apparatus that provides emergency power to a load when the input power source or mains power fails.

Explanation:

Your welcome :) PLZ mark brainliest

describe at least five ways in which information technology can help studying subjects other than computing​

Answers

Answer:

I'd that IT can help in a great many different fields like

Mathematics, in a manner of solving complex math equations

Statistics, in a manner of creating complex graphs with millions of points

Modeling, in a manner of creating models from scratch, either for cars, personal projects or characters for video games and entertainment

Advertising, in a manner of using IT to create not only the advertisements themselves but also, spreading that advertisement to millions in a single click

Music/Audio, in a manner of creating new sounds and music that wouldn't be able to work in any practical manner

Explanation:

9.2.2: Output formatting: Printing a maximum number of digits. Write a single statement that prints outsideTemperature with 4 digits. End with newline. Sample output with input 103.45632: 103.5

Answers

Answer:

The single print statement that does the required in python is:

print("%.4g" % outsideTemperature)

Explanation:

The full program is as follows:

The first line prompts user for input

outsideTemperature = float(input("Outside Temperature: "))

To print significant figures, we make use of g formats. And this is implemented as follows:

print("%.4g" % outsideTemperature)

The above prints 4 significant digits of outsideTemperature

For other significant figures, simply change the 4 to another number

HELP URGENTLY!!!!!

Elly supervises an eye doctors office. The office recently received new equipment. To keep that equipment working accurately and dependably, she should:
(Select all that apply.)

Copy the users manual and distribute to all the employees
Identify individuals to complete the tasks
Create a log to document maintenance
Set up auto reminders
Read the manual
List the maintenance tasks
Establish the frequency of the maintenance tasks
Update the software in the office

Answers

Note that where Elly supervises an eye doctor's office, and the office recently received new equipment, to keep that equipment working accurately and dependably, she should:

Copy the users manual and distribute to all the employeesCreate a log to document maintenanceSet up auto remindersRead the manualList the maintenance tasksEstablish the frequency of the maintenance tasksUpdate the software in the office.

What is the rationale for the above response?

In order to ensure that the equipment is working properly and optimally, Elly should distribute the user manual to all employees.

In addition, she should identify individuals to complete maintenance tasks, create a log to document maintenance, set up auto reminders, read the manual, list the maintenance tasks, establish the frequency of the maintenance tasks, and update the software in the office to keep new equipment working accurately and dependably. This will ensure optimal equipment maintenance and lifetime.

Learn more about equipment maintenance:

https://brainly.com/question/21853224

#SPJ1

Write a program that contains three methods:

Method max (int x, int y, int z) returns the maximum value of three integer values.
Method min (int X, int y, int z) returns the minimum value of three integer values.
Method average (int x, int y, int z) returns the average of three integer values.

Answers

Answer:

#include <stdio.h>//defining header file

int max (int x, int y, int z) //defining a method max that hold three parameters

{

   if(x>=y && x>=z)//defining if block that checks x is greater then y and x is greater then z

   {

       return x;//return the value x

   }

   else if(y>z)//defining else if block it check y is greater then z

   {

       return y;//return the value y

   }

   else//else block

   {

       return z;//return the value z

   }

}

int min (int x, int y, int z) //defining a method max that holds three parameters

{

if(x<=y && x<=z) //defining if block that check x value is less then equal to y and less then equal to z

{

return x;//return the value of x

}

if(y<=x && y<=z) //defining if block that check y value is less then equal to x and less then equal to z

{

return y;//return the value of y

}

if(z<=x && z<=x)//defining if block that check z value is less then equal to x  

{

return z;//return the value of z

}

return x;//return the value of z  

}

int average (int x, int y, int z) //defining average method that take three parameters

{

int avg= (x+y+z)/3;//defining integer variable avg that calculate the average

return avg;//return avg value

}

int main()//defining main method

{

   int x,y,z;//defining integer variable

   printf("Enter first value: ");//print message

   scanf("%d",&x);//input value from the user end

   printf("Enter Second value: ");//print message

   scanf("%d",&y);//input value from the user end

   printf("Enter third value: ");//print message

   scanf("%d",&z);//input value from the user end

   printf("The maximum value is: %d\n", max(x,y,z));//calling the method max

   printf("The minimum value is: %d\n", min(x,y,z));//calling the method min

   printf("The average value is: %d\n", average(x,y,z));//calling the method average

   return 0;

}

Output:

Enter first value: 45

Enter Second value: 35

Enter third value: 10

The maximum value is: 45

The minimum value is: 10

The average value is: 30

Explanation:

In the above-given code, three methods "max, min, and average" is declared that holds three integer variable "x,y, and z" as a parameter and all the method work as their respective name.

In the max method, it uses a conditional statement to find the highest number among them.In the min method, it also uses the conditional statement to find the minimum value from them.In the average method, it defined an integer variable "avg" that holds the average value of the given parameter variable.In the main method, three variable is defined that inputs the value from the user end and passes to the method and print its value.      
Other Questions
What is the value of x? Please provide an explanation, thanks! In the tell tale heart The old man trying to sleep and telling himself nobody is in the house is ironicbecause...A. The narrator is watching him through the creviceB. He knows the narrator is in the roomC. There are crickets under the bedD. There is a mouse running around in the room Hai came someone help I too lazy to do it... what is equivalent to x+x ?a)xxb)2xc)x^2d)2^x Is 12.95 x 10^4 a Scientific Notation? Yes or No? Explain. 1. Identify two reasons why some supporters of the decision consider it a victory for free speech. (2 points) HELPPPPPPPPPPPPPPPPPPPPPPPPPPPP MEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE In order to maintain homeostasis, the human body must be able to get rid of the waste products produced by cellular processes. The kidneys, for example, are responsible for removing waste from the bloodstream by producing urine. Urine produced in the kidneys then travels through the ureter and into bladder, and is finally expelled from the body by the urethra. The kidneys, ureter, bladder, and urethra help the body maintain homeostasis through the process of what? - 2 (k+ 3) > - 2k - 7 1.Amit buys a pair of jeans for $33. He must pay 7% sales tax. He gives the cashier $40. How much change does he receive back?2. Harold buys a backpack that costs $24.80. It is on sale for 25% off. Harold also has a coupon for an additional 10% off the lowest price. What is the final price of thebackpack (not including tax)?3. Sarah buys a book for her music lessons that cost $24. It is on sale for 15% off, and she must pay 5% sales tax. What is the final price of the book?4. Erik buys carrots and dip for a class snack. The carrots are $3.80, and the dip is $2.60. Erik has a coupon for 5% off his groceries. He does not need to pay tax. He gives the cashier $20. How much change does he receive back?5. Liam buys a new TV that cost $360. The TV is on sale for 40% off, and the store is offering an additional 20% off all sale items. How much does Liam save on the TV? What would you say it means to take a scientific approach to medicine? What makes the work of these two scholars, and later scientists, especially important in the study of anatomy and physiology? help please ASAP!!!!!you can zoom in to see better 5. Describe the trip from your home to school using the wordsposition, distance, displacement, and speed. helllllllllllllppppppppppppppppppppppplzzzzzzzzzzzzzzzzzz Anne applies a force on a toy car and makes it move forward. What can be said about the forces acting on the toy car at the moment Anne applies the force?The forces acting on the toy car are ___A. restrictedB. Balanced C. EqualD. Unbalanced Write the equation of a line perpendicular to y=-5x that passes through the point (1,1) in slope intercept form. (This question is worth 2 points. One point for the correct slope and the second point is for the correct y intercept.) In a particular game, the probability of winning $95 is 1/36 and the probability of losing $7 is 35/36. What is the expected value after playing this game? Round to the nearest cent. Suppose that a company has fixed costs of $23 per unit and variable costs $10 per unit when 13,500 units are produced. What are the fixed costs per unit when 10,000 units are produced? Read the following excerpt:"They sat about with their feet in the gutters, under the jacaranda trees that made a greentunnel of the street --for it was a beautiful suburb, spoilt only by their presence-- and sometimes they fell asleep lying right before the gates in the midday sun. The wife could never see anyone go hungry. She sent the trusted housemaid out with bread and tea, but the trusted housemaid said these were loafers and tsotsis, who would come and tie her and shut her in a cupboard." What do these lines reveal about the wife as a character? (RL.2.6)Group of answer choicesShe is a coward.She is affectionate.She is stubborn.She is sympathetic. What was Henry Hudson known for? Could someone explain ASAP!!!!!