1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
n200080 [17]
3 years ago
9

Write a program that repeatedly reads in integers until a negative integer is read. The program keeps track of the largest integ

er that has been read so far and outputs the largest integer when the (first) negative integer is encountered. (See subsection Example: Finding the max value of section 4.1 Loops (general) to practice the algorithm).
Computers and Technology
1 answer:
vfiekz [6]3 years ago
5 0

Answer:

In Python:

num = int(input("Enter number: "))

maxn = num

while num >=0:

   if num>maxn:

       maxn = num

   num = int(input("Enter number: "))

print("Largest: "+str(maxn))

Explanation:

Get input from the user

num = int(input("Enter number: "))

Initialize the largest to the first input

maxn = num

This loop is repeated until a negative input is recorded

while num >=0:

If the current input is greater than the previous largest

   if num>maxn:

Set largest to the current input

       maxn = num

Get another input from the user

   num = int(input("Enter number: "))

Print the largest

print("Largest: "+str(maxn))

You might be interested in
Choose the type of collection created with each assignment statement
Leviafan [203]

Answer:

dictionary

tuple

list

Explanation:

4 0
3 years ago
When an employee is told that his job will be outsourced within a year, he knows that his job will become unnecessary
Anvisha [2.4K]
False!! Hope this helps
8 0
3 years ago
To rename a worksheet, you change the text on the ? HELP ASAP
prohojiy [21]
If this is Excel, it would be C. Sheet tab
5 0
2 years ago
10 points if right...
aivan3 [116]

email because with chat it might wake up the kids and wbsite doesnt make sense. neither does blog so with email you can give personal messages and pictures.

7 0
3 years ago
Read 2 more answers
Given the class 'ReadOnly' with the following behavior: A (protected) integer instance variable named 'val'. A constructor that
Dafna1 [17]

Answer:

I believe you want a subclass so here it is!

public class ReadWrite extends ReadOnly {

public ReadWrite(int initialValue){

super(initialValue);

}

private boolean modified = false;

public void setVal(int x) {

val = x;

modified = true;

}

public boolean isDirty() {

return modified;

}

}

Explanation:

I might be wrong, just check through it in case

Hope this helped

:)

7 0
3 years ago
Other questions:
  • Which company provides the Loki Wi-Fi mapping service?
    10·1 answer
  • List the steps that you need to locate Microsoft Word on your computer
    7·1 answer
  • What are the most popular/up-and-coming social media applications?
    10·2 answers
  • How does microchip work
    12·1 answer
  • 4. Who developed the first design technology program which had a
    12·1 answer
  • When evaluating portable CD players, you consider price, the sound quality, and ease of using the controls. These are your _____
    8·2 answers
  • Be my friend plzzzzzzz
    7·2 answers
  • _____________________ denotes the use of human interactions to gain any kind of desired access. Most often, this term involves e
    11·1 answer
  • Who can help me on my school we will to google meet and i share my screen
    5·1 answer
  • When you listen to a guitar duet and have trouble hearing the melody, which of the following would best explain the problem?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!