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]
3 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]3 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
What should you always do to clean off tables
ikadub [295]
Wipe then off then spray them down then wipe off again
7 0
3 years ago
Read 2 more answers
4. What are five actions you should do to care for your camera?
den301095 [7]
Adding to the one above,
Keep food or drinks away from the camera
7 0
3 years ago
Your company shares a building with a competitor's branch office. Recently, you noticed that some computers other than company c
professor190 [17]

<u>The wireless network:</u>

Wireless networking and internet access are essentials when it comes to the smooth functioning of an enterprise. Certain information can be transferred from one computer to another within a specified if they are connected to a network.

In this case, as the company shares the building with the branch office of a rival company there may be repercussions. First of all, the company's wireless network should be equipped with a strong password and it should be changed regularly too.

Next, the officials responsible for networking should also monitor the range of their wireless network. There is no point in keeping the range of wireless network wide as it is to be used by employees only and they can access it on the company's premises.

5 0
3 years ago
I know this aint like a question about school work, but I really need help with a problem. My mom took my phone away for like tw
igomit [66]

Answer:

use hangouts and fb messenger to text people

Explanation:

4 0
3 years ago
Read 2 more answers
Explain the types of computer on the basis of work​
USPshnik [31]

Answer:

There are three types of the computer on the basis of work. They are analog, digital, and hybrid computer.  The computer that work with natural phenomena and physical values like earthquake measurement, speed of the wind, weight light etc is known as Analog computers.

Explanation:

3 0
3 years ago
Other questions:
  • Using functions,
    6·1 answer
  • Which option of the AutoCorrect tool enables you to add and delete words that do not follow abbreviation rules?
    12·1 answer
  • What part of speech is contend
    6·1 answer
  • Algorithm for arithmetic mean program
    13·1 answer
  • Victoria is creating a brochure for her photography studio. She designed the layout and placed a photo in the center of the page
    13·1 answer
  • Consider the following code snippet:public static void main(String[] args) throws FileNotFoundExceptionWhich of the following st
    10·1 answer
  • What is an example of a governmental influence ?
    9·2 answers
  • ________ is a model of computing in computer processing, storage, software, and other services which are provided as a shared po
    9·1 answer
  • Write a test program that prompts the user to enter three sides of the triangle (make sure they define an actual triangle), a co
    5·1 answer
  • Nicole is in a study group to prepare for a test on plant biology, a subject she knows a lot about. During their meetings, she a
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!