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
olya-2409 [2.1K]
2 years ago
5

Write a program that reads 20 integers from the user into an array and uses a function arrayMinimum that accepts an integer arra

y along with its size as parameters and returns the smallest element of the array. The program needs to output the result (the smallest array element).
Computers and Technology
1 answer:
neonofarm [45]2 years ago
6 0

Answer:

#include <iostream>

using namespace std;

int arrayMinimum(int myArray[], int myArraySize) {

int small = myArray[0];

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

   if(myArray[i]<small){

small = myArray[i];

}

 }

 return small;

}

int main(){

   int myArray[20];

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

       cin>>myArray[i];          

   }

   cout<<"The smallest is: "<<arrayMinimum (myArray,20);

   return 0;

}

Explanation:

This solution is provided in c++

#include <iostream>

using namespace std;

This line defines the arrayMinimum function

int arrayMinimum(int myArray[], int myArraySize) {

This initializes the smallest of the array element to the first

int small = myArray[0];

This iterates through the array

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

This if condition checks for the smallest

   if(myArray[i]<small){

The smallest is assigned to the small variable

small = myArray[i];

}

 }

This returns the smallest

 return small;

}

The main method begins here

int main(){

This declares an array of 20 elements

   int myArray[20];

The following iteration allows user input into the array

<em>    for(int i =0;i<20;i++){ </em>

<em>        cin>>myArray[i];          </em>

<em>    } </em>

This calls the method and returns the minimum

   cout<<"The smallest is: "<<arrayMinimum (myArray,20);

   return 0;

}

You might be interested in
Point to ______ of a cell to fill the cell to the right or down.
UNO [17]

Answer:

It's "The bottom left corner"

Explanation:

8 0
1 year ago
Read 2 more answers
Disadvantages assembly level language for programming ​
Alisiya [41]
It takes a lot of time and effort to write the code for the same. It is very complex and difficult to understand. The syntax is difficult to remember. It has a lack of portability of program between different computer architectures.

Hope that helps
7 0
2 years ago
Read 2 more answers
Which of the following is the biggest issue facing wireless communication today?
anygoal [31]

Answer:

threats to privacy

Explanation:

7 0
2 years ago
Plz go sub 2 "Shyy096" he is a 11 y/o boy and makes music fortnite vids, it would rly help him if u subscribe cuz he only has 8.
Pachacha [2.7K]

Answer:

OKK

Explanation:

5 0
2 years ago
What is activated as necessary to support local eocs and to ensure that responders have the resources they need to conduct respo
gizmo_the_mogwai [7]

Answer: Emergency Operation Center (EOC)

Explanation:

An Emergency Operation Center is the coordination base for emergency service in case there is any within a state or a state Connecticut. The major purpose of the emergency center is to be in charge of controlling deploying and utilizing facilities needed to prepare for any form of emergency, disaster management, etc.

To run an effective Emergency Operation Center, focus must be on the facilities, equipments and personnel involved.

3 0
3 years ago
Other questions:
  • Windows enables each user to establish a ____, which identifies to windows the resources, such as apps and storage locations, a
    6·1 answer
  • Match the following.
    8·2 answers
  • Why is it important to evaluate the website on which you plan to shop?
    11·2 answers
  • What is the printout of the call nPrint("a", 4)?
    14·1 answer
  • Technician A says that to cover all possible vehicle conditions, coolant must have a high freezing point. Technician B says cool
    6·2 answers
  • William found out that someone used his report on american culture without his permission. what is william a victim of?
    11·1 answer
  • Which component of the windows desktop allows you to retrieve files that have recently been deleted?
    11·1 answer
  • Write a method doubleUp that doubles the size of a list of integers by doubling-up each element in the list. Assume there's enou
    13·1 answer
  • What is the main circuit board inside the computer called?CD-ROMY
    12·1 answer
  • Blockquote
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!