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
Ivahew [28]
3 years ago
9

Write an algorithm that receives 500 numbers from the user and prints out the maximum of the numbers.

Computers and Technology
1 answer:
dusya [7]3 years ago
3 0

Answer:

Algorithm:

1.Create a variable "maxx" and initialize it with INT_MIN.

2.Create an array of size 500.

3.for i=0 to 499.

 3.1 Read value from user and store in array.

 3.2 if input >maxx.

 3.3 maxx=input.

4.maxx will have the largest of all 500 numbers.

5.end program.

Implementation In C++:

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variable

int maxx=INT_MIN;

// array of size 500

int arr[500];

cout<<"Enter 500 numbers:";

for(int i=0;i<500;i++)

{// read input number

    cin>>arr[i];

// find maximum

    if(arr[i]>maxx)

    maxx=arr[i];

}

// print maximum

cout<<"Maximum of all:"<<maxx<<endl;

return 0;

}

You might be interested in
When you’re in the Normal view, what are the visible panes?
zheka24 [161]

a

pleas give branlest

6 0
3 years ago
Read 2 more answers
Suppose that the code below is the body of some loop. Given variables x and y write some code that reads a value into the variab
ra1l [238]

Answer:

I will code in JAVA.

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

     float x;

     float y;

     float result;

     Scanner input = new Scanner(System.in);

     while(true){ <em>//this is an infinite loop</em>

       x = input.nextFloat(); <em>//wait the input for x</em>

       y = input.nextFloat(); <em>//wait the input for y</em>

       if(y == 0) {

         continue; <em>//next iteration without print.</em>

       } else{

         result = x/y;

         System.out.print(result); <em>//print the result.</em>

       }

     }

 }

}

Explanation:

To get the numbers, you need to import Scanner class, and use the method nextFloat() to admit floats and integers.

If y is 0 then, executes the continue statement, if not prints the division between x and y.

4 0
4 years ago
When Building a resume what would i put when it says field of study especially when your still going to high school?​
Nastasia [14]
Just put Still attending or Enter Highschool then if they ask you about it just let them know your still attending, that’s what I did and got the job on the spot
6 0
3 years ago
Maria's company recently experienced a major system outage due to the failure of a critical component. During that time period,
stira [4]

Answer:

A. Opportunity cost.

Explanation:

Opportunity cost shows a relationship between scarcity and choice. The choice and best source of sales for Maria's company is through online product request on e-store website.

The company has two options for sales, the online sales and physical sales in the company itself. When the company's system fails, they decide to focus on the physical sales for the duration of the system failure.

The opportunity cost is the online sales which was put aside for physical sales.

8 0
3 years ago
Which of the following statements is NOT a valid way to create a date object named birthday?
dem82 [27]

Answer:

var birthday = "12/2/1978";

Explanation:

It does not create a date object named birthday because in this statement the birthday is a string which contains 12/2/1978 a date it is not date object it is a string.All other three options are correct way to create a date object.

var birthday = new Date();

creates a date object with the current date and time.

we can also pass date string in the new Date().So var birthday = new Date("12/2/1978"); is also correct.

we can also pass year,month,day in new Date() In this order only.So option fourth is also correct.

4 0
3 years ago
Other questions:
  • What two methods can be used to access and modify an existing program that is running on an iot device in cisco packet tracer? (
    6·1 answer
  • Which is true of effective passwords?
    5·1 answer
  • the moon is about 240,000 miles from the earth what is this distance whitten as a whole number multiplied by the power of ten
    10·1 answer
  • When would it be beneficial to make a copy of a document
    10·1 answer
  • what will allow you to immediately exit the program without rebooting the computer, when you realize your browser is not respond
    7·1 answer
  • What is the definition of trouble shooting.
    12·1 answer
  • What do you call the processing of converting an image to binary?
    7·2 answers
  • How am I supposed to delete my Brainly account if I don't know my password and my E-mail is made up?
    13·2 answers
  • A security event popped up, alerting security of a suspicious user gaining access to, and copying files from, the %systemroot%\n
    11·1 answer
  • Can you show me how to code this is GDBonline? explaining each statement with notes//
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!