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
vredina [299]
3 years ago
11

Create a program to determine the largest and smallest number out of 15 numbers entered (numbers entered one at a time). This sh

ould be done in a function using this prototype: double larger (double x, double y); Make sure you use a for loop expression inside your function. Enter 15 numbers 11 67 99 2 2 6 8 9 25 67 7 55 27 1 1 The largest number is 99
Computers and Technology
1 answer:
Shkiper50 [21]3 years ago
7 0

Answer:

#include <iostream>

using namespace std;

double larger( double x, double y){

   if (x > y){

       return x;

   } else{

       return y;

   }

}

int main(){

   int n, max = 0;

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

       cout<< "Enter item"<< i+1 << ": ";

       cin>> n;

       cout<< "\n";

       max = larger( n, max);

   }

   cout<<"The maximum number is: "<< max;

   return 0;

}

Explanation:

The C++ program defines the function 'larger' that compares and returns the largest of two numbers. The main program prompts the user for 15 numbers and the larger function is called to return the largest of the fifteen numbers given.

You might be interested in
How to add bullet points in google slides??
Anettt [7]
<span>Open a document or presentation.Add or select a text box.<span>On the toolbar, click Bulleted list  or Numbered list .<span>Note: If you don't see the option, click More.</span></span>To change the style of the bullets or numbers, click the dropdown arrow next to the icons in the toolbar</span>
6 0
4 years ago
Read 2 more answers
Scrie un program care citind varstele a 2 copii afiseaza care dintre ei este cel mai mare si cu cat. Exemplu: Pentru varstele 5
murzikaleks [220]

Answer:

primul_copil = int(input("Introduceți vârsta primului copil: "))

aldoilea_copil = int(input("Introduceți vârsta celui de-al doilea copil: "))

def copilmai_mare(varsta1, varsta2):

   if varsta1 > varsta2:

       diferenta = varsta1 - varsta2

       print("copilul mai mare este varsta1 cu diferența de vârstă de: ", diferenta )

   else:

       diferenta = varsta2 - varsta1

       print("copilul mai mare este varsta2 cu diferența de vârstă de: ", diferenta )

copilmai_mare(primul_copil, aldoilea_copil)

Explanation:

Programul python de mai sus definește o funcție "copilmai_mare" care ia două argumente "varsta1" și "varsta2". Diferența dintre vârstele copiilor este comparată, iar cel mai mare copil și diferența sunt tipărite pe ecran.

5 0
3 years ago
Let T be the statement: The sum of any two rational numbers is rational. Then T is true, but the following "proof is incorrect.
ikadub [295]

Answer:

the mistake is in the first statement.

Explanation:

Now lets us put the statement into consideration:

"The sum of any two rational numbers is irrational"

The negation is: " there exists a pair of rational numbers whose sum is irrational". (Existence of at least one of such a pair).

The negation is not "the sum of any two rational numbers is irrational"

Therefore the mistake is in the first statement and it is due to incorrect negation of the proof.

4 0
3 years ago
(a) Show how to use (the Boolean formula satisfiability program) satisfiable num (and substitute) to find a satisfying assignmen
tia_tia [17]

Answer:

Check the explanation

Explanation:

(a)

# We need to try all options(TRUE/FALSE) of all the Variables

# to find the correct arrangement.

permutations <- permutate(0,1,n) [Find all permutions O(2^n)]

for permutation in permutations:

for X in variables:

if(permutation[i] == 1)

substitute(H,X,true)

else

substitute(H,X,false)

if(satisfiable(H)) return permutation

increment i

6 0
3 years ago
Which of the following is NOT one of the MOST common uses of Twitter?
I am Lyosha [343]
Which of the following is NOT one of the MOST common uses of Twitter? b . Making a business contact.
5 0
3 years ago
Other questions:
  • 40 POINTS I NEED THESE ANSWERS ASAP GIVE ME THE RIGHT ASNWER AND ILL PUT YOU AS THE BRAINLIEST
    13·1 answer
  • The atomic number of oxygen is 8. the atomic mass of oxygen is 16. him many neutrons does oxygen have
    12·1 answer
  • Using the ____ browsing mode offered by some browsers can prevent personal information from being left on a public computer.
    9·1 answer
  • Investigations involving the preservation, identification, extraction, documentation, and interpretation of computer media for e
    12·1 answer
  • CHALLENGE ACTIVITY 2.15.1: Reading and outputting strings. Write a program that reads a person's first and last names, separated
    11·1 answer
  • Given two variables firstInClass and secondInClass which have already been associated with values, write code which swaps the va
    9·1 answer
  • By recording where a hockey puck goes into a net, a goalie can...
    8·2 answers
  • There are two circular grounds Ground-A and Ground-B. Ground-A is having diameter of 15 meters and Ground-B is having diameter o
    7·1 answer
  • Maria wants to create an image for a Web page. Maria should use _____. help me
    8·2 answers
  • Which command will provide us with a list of the available internal commands (commands that are part of Command Prompt, such as
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!