Write a C++ program that reads n integer values and stores them in an array of maximum 20 integers. Read from the user a valid value of n (n should not exceed 20). After reading the n array elements find and display the maximum and minimum elements.

Answers

Answer 1

Answer:

Following are the code to this question:

#include<iostream>//defining header file

using namespace std;

int main ()//defining main method

{

int x[20], n, i, maximum, minimum;//defining an integer array x and another integer variable  

cout <<"Enter the number of element you want to insert: ";//print message

cin >>n;//input size value from user end

if(n>20)//defining if block that check n is greater then 20

{

cout <<"The size of array should not exceed 20 element";//print message

return 0;//return 0

}

else//defining else block

{

cout<<"Enter array value: ";//print message

for(i=0;i<n;i++)//defining for loop

cin>>x[i];//defining for loop for input array value

maximum =x[0];//defining maximum variable that hold array value

for (i=0;i<n;i++)//defining for loop for check value

{

if(maximum<x[i])//defining if block to check maximum value

{

maximum=x[i];//hold maximum value

}

}

minimum=x[0];//use minimum variable to hold array value

for (i=0;i<n;i++)//defining for loop to hold minimum value

{

if (minimum>x[i])//defining if block to check minimum value

minimum =x[i];//hold minimum value

}

cout << "Maximum element : " << maximum ;//print maximum value  

cout << "Minimum element : " << minimum ;//print minimum value

return 0;

}

}

Output:

Enter the number of element you want to insert: 7

Enter array value:  

8

6

22

13

98

554

3

Maximum element : 554

Minimum element : 3

Explanation:

In the above-given program, an integer array "x", and four integer variable "n, i, maximum, and minimum" is defined, which uses the if block to check the size of the array.

In the else block, it inputs the array value from the user end and after input value, it uses the conditional statement to check the "maximum and minimum" value in its variable and print its value.


Related Questions

Documentary photographers strive to produce what type of image?
А.
Edited
B.
True
C.
Colorful
D.
Blurred

Answers

I’m pretty sure that the answer is B

Answer:

B. :)

Explanation:

BRAINLIEST

When using design templates, these elements will be determined for you.
bullets
background
color scheme
content
title
font

Answers

Answer:

background

color scheme

font

I think thats all

Explanation:

Please give me Brainly

When using design templates, the elements that will be determined for you are color scheme and background. The correct options are b and c.

What is designing a template?

The template is creating a document that has a copy of itself. Design templates are ready-made layouts and written materials that can be altered.  For example, if you have a template of office content, then you can use it for another word document. You don't have to start from scratch.

In order to maintain consistency among users and media, templates are frequently created to adhere to certain rules or specifications. You can make new templates for later use, or utilize pre-designed templates from template libraries and websites.

Therefore, the correct options are b, background, and c, color scheme.

To learn more about template, refer to the link:

https://brainly.com/question/28193778

#SPJ2

In game design, what refers to commands that are executed in a certain order?
blueprints
code blocks
instructions
sprites

Answers

Answer:

instructions

Explanation:

It's just called instructions.

instructions is the answer

you are working on creating a business document with two other co-workers. Based on just information, which of the following pre-writing strategies would be the best for you?(A.P.E.X.)

Answers

Brainstorming, Rationalizing, and Rough Drafts.

To find the location’s name of the cell, look to the . To add an action to the cell for that data, add commands in the . To move from one cell to the next, use .

Answers

Answer:

Name Box

Formula Bar

Either Tab or Enter

Explanation:

Answer:

To find the location’s name of the cell, look to the

✔ name box

.

To add an action to the cell for that data, add commands in the

✔ formula bar

.

To move from one cell to the next, use

✔ either tab or enter

.

Explanation:

Which of the following BEST describes the relationship between the Boston Marathon bombing and biometrics?

Answers

Answer:

Because of the newly developed biometric technology, the FBI was able to

quickly identify two suspects.

The blurry photos released by the FBI after the bombing prompted

researchers to improve their early biometric software.

Because biometric technology was unavailable at the time, the Boston

Marathon bomber remains at large.

The Boston Marathon bombing made researchers aware of how biometric

technology is sometimes useless and ineffective.

Explanation:

How did New York Governor Hugh Carey handle Sostre’s situation?

Answers

Answer:

The governor found a way to free Sostre without assessing whether or not he was guilty or innocent of drug crime in buffalo.

Explanation:

Answer:

The governor found a way to free Sostre without assessing whether or not he was guilty or innocent of drug crime in buffalo.

Explanation:

correct on e2020 Dawg

A battery is connected to a light bulb in a circuit. There is a current of 2 A in the light bulb. The voltage of the battery is 1.5 V. What is the resistance of the light bulb?

Answers

Answer:

The current in a circuit is directly proportional to the electric potential difference impressed across its ends and inversely proportional to the total resistance offered by the external circuit. The greater the battery voltage, the greater the current.

Explanation:

HELP ME
How does removing the paper backing on photographs allow Michal Macku to create creatively distorted pictures?

Answers

Answer:

Since the end of 1989, Michal Macku has used his own creative technique which ... Created on photographic quality paper, each Gellage is a highly durable print ... Photographic pictures mean specific touch with concrete reality for me, one ... I do what I feel, and only then do I begin to meditate on what the result is.

Explanation:

The inference shows that removing the paper allows the picture to be more flexible so that it can be reformed to something new.

What is an inference?

It should be noted that an inference simply means the conclusion that can be deduced from the information given in a story.

In this case, the inference shows that removing the paper allows the picture to be more flexible so that it can be reformed to something new.

Learn more about inference on:

https://brainly.com/question/1081576

Focusing on the general characteristics of a problem or object, while ignoring the details, is a technique called
O refinement
O abstraction
O decomposition
O pattern recognition

Answers

Answer:

Abstraction

Explanation:

In computer science, abstraction has a similar definition. It is a simplified version of something technical, such as a function or an object in a program. The goal of "abstracting" data is to reduce complexity by removing unnecessary information. At some level, we all think of computers in abstract terms.

A
loop has a built in count variable.
for
while
range
function

Answers

Answer:

For

Explanation:

If what I am thinking is right, it would be for because a for loop counts how many times it needs to be ran

You frequently want to take some sort of action on each value in an array when you have values in an array. To access each element individually while iterating through the entire array, use a for loop. Thus, option C is correct.

What for is included in built in count variable?

A variable is often used in a counting loop to count from an initial value to an end value. The index variable is another name for this variable.

The index variable used in this illustration is i. A counting loop typically consists of the following six parts: Setup clauses.

A counter variable must be given a starting value. Test: It must perform a test on the counter variable by contrasting it with a result.

Therefore, The function accepts an iterable and returns an object with tuples, the first member of which is the item's index.

Learn more about count variable here:

https://brainly.com/question/13218753

#SPJ2

Software licensed as proprietary

is usually free of cost often has lower quality than other types.

does not permit source code changes.

is rare in today's marketplace.

can be redistributed by the user at will.​

Answers

Answer:

Does not permit source code changes.

Explanation:

Answer:

does not permit source code changes.

Explanation:

What can you do if brainstorming only gives you a small or incomplete idea?
A. Brainstorm again
B. Develop the idea through research
C. Develop the idea through a close reading of a literary text
O
D. All of the above

Answers

Answer:

D. All of the above

Explanation:

BUYING A NEW COMPUTER
Scott is getting a new computer. He has three options for secondary storage. He could
choose
a 6TB hard disk drive
a 2TB solid state drive
a hybrid 500GB solid state with a 4TB hard disk
For each option provide some reasons why Scott may choose that option instead of the
alternatives.
IS​

Answers

6 TB- Choose this if you are getting the computer for work use, always pick the highest amount of storage for everyday use.

2TB SSD- This is the worst option because its the least among the others, but if you were just a game this may suit you.

500 GB SSD with 4TB- This would be the best option for someone who games, edits, or does graphics, because you get the storage but you also get 500 GB of SSD to load your software on, which will help it launch faster and run smoother.

What are the 3 coding languages?

Answers

Answer:

What theres a code

Explanation:

Write a function that takes the name of a file with a .csv extension (a comma-separated value file), and writes a new file that is equivalent (same name and same data) but with a .tsv extension (a tab-separated value file: like a CSV but with tabs instead of commas separating the elements of the file). Note: the character used to represent a tab is ‘\t’.

Answers

Answer:

import pandas as pd

def convert_to_tsv( csv_filename ):

   df = pd.read_csv("csv_file")

   df.to_csv("csv_filename.tsv", sep='\t')

Explanation:

The python program uses the pandas' module to read in the csv file in the function "convert_to_tsv". The file is saved as a tsv file with the pandas to_csv method and the " sep= '\t' " attribute.

Which best describes what happens when a formula is copied from one cell to another?
The cell references in the formula remain the same to match the cell that the formula is pasted into.
The cell references in the formula remain the same as they were in the original cell.
The cell references in the formula change to match the cell that the formula was copied from.
O The cell references in the formula change to match the cell that the formula is pasted into.
Hurry up

Answers

Answer:

b 2

Explanation:

b2

Write a program that asks the p34won to enter their grade, and then prints GRADE is a fun grade. Your program should repeat these steps until the user inputs I graduated

Answers

Answer:

Following are the code to this question:

def fun():#defining a method fun

  while True:#defining a while loop  

      g = input("Enter your grade: (I graduated) ")#defining variable g for input value

      if g == "I graduated":#defining if block to check string value

          return 0#return  

      print("{} is a fun grade".format(g))#use print method to print string value  

fun()#calling the method

Output:

Enter your grade: (I graduated) 1st

1st is a fun grade

Enter your grade: (I graduated) 2nd

2nd is a fun grade

Enter your grade: (I graduated) I graduated

Explanation:

In the given python code, a method "fun" is defined, and inside the method, a while loop is defined, which uses a variable "g" for input value from the user-end.

In the next step, if block is defined to check string a value and return a value 0, and use the print method to print the given value, and call the above method fun.  

Imagine yourself writing computer programs in the future. Which do you think would be generally more important to your programming goals: ease of programming or speed of computation? Why do you think this would be more important? Describe a situation for which the other goal would be more important.

Answers

Answer:

to make sure ur comsters are satified

Explanation:

To summarize means to
O. Directly quote the main idea
O. Communicate the main idea with supporting details
O. Explain the main idea’s significance
O. Condense the main idea into a few words

Answers

Answer:

To summarize is to explain the main idea in as few words as possible. So the answer is the last statement, to "Condense the main idea into a few words". Hope this helped.

Answer:

Its D

Explanation:

Hope it helped

Find and Explain 3 different sources of Kinetic Energy in your house that are utilized on a daily basis?

Answers

1.)When you turn on a light with a traditional incandescent light bulb, it gives off two forms of energy. There is the visible light that you see, as well as the warmth that it generates

2.) When you place a frozen pizza in the oven, you are heating it up and raising its temperature

3.) A light fixture that is plugged into a wall outlet and is turned on is another example of electrical energy

Tony, the team photographer, will be accompanying his college football team to their next away game. He will be shooting photos of his team in action on the field. Which equipment would be ideal for Tony to use for his work? A. suction mount B. shoulder mount C. pistol grip D. mini tripod E. crane

Answers

Answer:

I think shoulder mount

Explanation: because you’ll generally use a shoulder mount for video shooting or when you use heavy telephoto lenses.

Elias is writing poems and is formatting several to fit on a page that has been divided into columns. Which column break would allow him to end one poem and start the next poem on the same page?

Question 6 options:
next page
sequential
text wrap
continuous

Answers

Answer:

Explanation:

Column break continous

how to determine if the behavior of a person using technology is a ethical or unethical? Give some examples. ​

Answers

Answer:

What is ethical behavior? A person who demonstrates ethical behavior has evidence of a strong moral code and a consistent set of values. Ethics can be rooted in belief or the pursuit of making the world better. Those who exemplify ethical behavior do the right thing regardless of whether they get credit for it.

limit the principles to five so that you can best incorporate them into your daily lives.

Make Things Better. ...

Treat Others Fairly. ...

Consider the Consequences of Your Actions. ...

Respect the Rights of Others. ...

Act with Integrity.

Determining What Is Ethical

Morality is based on duty. When you do the right thing, it is not the outcome of the act that is the measure of its morality, but rather your intent.

An act is moral if it could become a universal rule of society.

On deciding the morality of an act, you must consider the perspective of the doer and the recipient.

Explanation:

Sorry if it's wrong

Source of the information : a book

The fireworks were a lantern in the sky

Answers

Answer:

So your saying thst when a firework blows then it is a big lantern in the sky???

Before he buys a new smartphone, Tim can best use data to

evaluate which phone he should get.
convince himself he wants a phone.
discredit others’ opinions on his phone choice.
recognize problems that all phones have.

Answers

It’s A or the first one, kinda like process of elimination, the second and third one are obviously eliminated first so then it’s just between a and d. But a makes more sense as to he has to buy one either way

Answer:

A.) Evaluate which phone he should get

Explanation:

Edge2020

Challenge #3: Create a network that keeps everyone connected even if one of the lines is cut Insert as many lines as needed

Answers

Answer:

To create a redundant computer network, The star network topology is adopted.

Explanation:

Note that topology is not a type of network but a top view of how the network looks like or is connected.

To make a network redundant, interconnect every computer to one another in the network, so even when a line or an ethernet cable ( the connector) makes, there is no loss of connection.

This form of network is not recommended for large computer networks as it would result in confusion due to excess connection cables running in the network.

PLS help im in the middle of this test
If someone enjoys the technical aspects of production but does not enjoy working with a large number of people, which career option might be best?


photojournalist
videographer
camera operator
print journalist

Answers

Answer:

Videographer

Explanation:

They work with a small grade while the other have to have good people skills

Justify the following statement: “Some Americans’ sedentary lifestyles contribute to their poor health.”

Answers

It is essential that people are active in their lives to fulfill that basic biological need. This will allow blood flow to increase, which is beneficial for health. In addition, it can release healthy chemicals into the brain, which is beneficial for mood, energy, and well-being.

Answer:

Since the average American will spend 24 hours watching television per week, it is safe to say that they suffer from a lack of movement and exercise. This, in turn, will lead more Americans to be overweight and more likely to suffer from serious health problems! :)

Explanation:

What piece of equipment changes the signal from the television camera into an electronic signal?
receiver
transducer
transponder

Answers

Answer:

Transponder

Explanation:

Transponder - a device for receiving a radio signal and automatically transmitting a different signal.

Answer:

transponder isnt correct i took the quiz its one of the other 2

Explanation:

the correct answer is transducer

Other Questions
Why do we see different stars at night during the year Why does the adoption of new technology tend to increase supply? What was the Aztec religious practices An airplane travels at a constant speed of 320 miles per hour. How far, in miles, will the airplane travel in 15 minutes? ive been reposting this question forever i really need help if u answer correctly i will mark brainliest look at the image i uploaded that is the question and it shows what answers i need i need help with this ^ There are 3.9 milligrams of calcium in a ounce of cooked chicken. How many milligrams are in 6 ounces? A local park is in the shape of a square. A map of the park is made with the scale of 1 inch to 200 feet. If one side of the park on the map is one foot long, how long is the side of the park in real life? Please help due NOW PLEASE HELP!!Will mark as brilliant Briefly describe your most horrible dystopia. History Question). Looking Back Time Line) Question 1: Choose two themes that would be appropriate for thematic time lines of important events from prehistory to A.D. 1600. Write these themes below. Theme 1, Theme 2. ( Question 2: Write five events for each of the two themes you chose. Event 1, Event 2, Event 3, Event 4, Event 5. (Theme 2): Event 1, Event 2, Event 3, Event 4, Event 5. ( Question 3) Choose one of the two from # 1 on which to create a thematic time line. Write the theme below. ( Question 4): Write the five time line entries below for the theme you chose in # 3. For each entry, write a short paragraph that explains why you included the event on your time line. Event 1: Rationale, Event 2: Rationale, Event 3: Rationale, Event 4: Rationale, Event 5: Rationale. ( Question 5) Submit a thematic time line for the theme you chose that includes at least five events. ( You can include up to ten events on your time line.) If you write down anything that doesn't contain to this assignment you Will Be Reported ASAP. ( I will be Marking Brainliest to whomever can help and knows what there doing for this assignment. Please be 1,000% sure. Very important. estimate and then compute each product. Check that your answer is reasonable. 531 X 4 7 1. T2. El seor Miguel3. Marisol4. Mis amigas y yo5. Los estudiantesuna clase de espaol.un libro.una computadora.unas guitarras.mucha tarea.muchos amigos.6. Ustedes After the passing of the Curtis Act, the Dawes Commission acted as a judicial tribunal with the authority to do all of thefollowing exceptA resolve land allotment disputesB. determine citizenship of American Indian claimsC. arrest American Indians who passively resisted allotmentD. allot land to those unable or unwilling to choose "Right Hand Man"Washington, Hamilton, Burr, Mulligan, Laurens, Lafayette, Angelica, Eliza,Peggy, and CompanyWhat technical element helps depict the harbor that the characters arelooking at?How is choreography used to portray canon fire? what was the cause of the duar war -10 + 4(3p + 10) = 18 solve for p The day had begun on a bright note. The sun finally peeked through the rain for the first time in a week, and the birds were sinf=ging in its warmth. There was no way to anticipate what was about to happen. It was a worst-case scenario and there was no way out of it.He heard the loud impact before he ever saw the result. It had been so loud that it had actually made him jump back in his seat. As soon as he recovered from the surprise, he saw the crack in the windshield. It seemed to be an analogy of the current condition of his life.Hopes and dreams were dashed that day. It should have been expected, but it still came as a shock. The warning signs had been ignored in favor of the possibility, however remote, that it could actually happen. That possibility had grown from hope to an undeniable belief it must be destiny. That was until it wasn't and the hopes and dreams came crashing down.Was it enough? That was the question he kept asking himself. Was being satisfied enough? He looked around him at everyone yearning to just be satisfied in their daily life and he had reached that goal. He knew that he was satisfied and he also knew it wasn't going to be enough.He sat across from her trying to imagine it was the first time. It wasn't. Had it been a hundred? It quite possibly could have been. Two hundred? Probably not. His mind wandered until he caught himself and again tried to imagine it was the first time. Help Plewse I beg u Natalia solved the problem 74.412=6.2. Complete the model with partial products to check Natalia's work using multiplication. A large rectangle is broken into 4 smaller rectangles The top line is labeled 6 and 0.2. The left side is labeled 10 and 2. The rectangles are divided between those labels. The top left rectangle is labeled A. The top right rectangle is labeled B. The bottom left rectangle is labeled C. The bottom right rectangle is labeled D. Part ADrag values to the boxes to complete the partial products. Not all choices will be used.0.4 1.2 2 4 6 12 20 60The product for A = .The product for B = .The product for C = .The product for D = .Part BChoose the words to complete the statement.Natalia's work is correct , because the total of the partial products is Choose... as the dividend.