answer.
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
mixer [17]
1 year ago
15

Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in

a program that takes two integer inputs, and outputs the largest magnitude value.
Ex: If the inputs are:

5 7
the function returns:

7
Ex: If the inputs are:

-8 -2
the function returns:

-8
Note: The function does not just return the largest value, which for -8 -2 would be -2. Though not necessary, you may use the absolute-value built-in math function.

Your program must define and call a function:
int MaxMagnitude(int userVal1, int userVal2)

code------------------------

#include
using namespace std;

/* Define your function here */

int main() {
/* Type your code here */

return 0;
}

Computers and Technology
1 answer:
JulsSmile [24]1 year ago
5 0

Answer:

def max_magnitude(user_val1, user_val2):

if abs(user_val1) > abs(user_val2):

return user_val1

else:

return user_val2

if __name__ == '__main__':

n1 = int(input("Enter the first integer number: "))

n2 = int(input("Enter the second integer number: "))

print("The largest magnitude value of", n1, "and", n2, "is", max_magnitude(n1, n2))

Explanation:

You might be interested in
Which is the correct notation to specify the following inheritance?
Alika [10]

Answer:

Create the student class object which inherit the printinfo() from the abstract class People

Explanation:

Classes in object-oriented programming are blueprints of a defined type of data structure.

An object of an abstract class cannot be instantiated. So, the People class in question, is only inherited by the Student class which able to use the define printinfo() method.

4 0
1 year ago
Mike has never used a slide software before, but he needs to create a presentation by the end of the week. what recourse would b
ankoles [38]

This is an incomplete question. The complete question is given below:

Mike has never used slide presentation software before but he needs to create a presentation by the end of the week what resource would be most helpful to mike

a. The 350-page printed manual from the slide presentation software publisher

b. A free tutorial the slide presentation software publisher has posted on the company website

c. A trouble-shooting website created by a third party

d. The 350-page online manual from the slide presentation software publisher

Answer:

b - A free tutorial the slide presentation software publisher has posted on the company website

Explanation:

As Mike has a short time and no prior experience with a slide software, then in this scenario, the best, simplest and fastest way to learn and create a presentation a free tutorial which the slide presentation software publisher has posted on the company website  as this is the same company that has created this particular software so he can be rest-assured that the resource he is relying on is authentic and up-to-date with information on latest features.

Moreover, it's efficient and quick way to learn from a free tutorial rather than from 350-page printed or online manual especially for a beginner.

Besides, his purpose is to create the presentation using the software and not trouble-shooting so trouble-shooting website created by a third party is not useful for him and it also might not be authentic or updated as well.

6 0
1 year ago
A school has 100 lockers and 100 students. All lockers are closed on the first day of school. As the students enter, the first s
kati45 [8]

Solution :

public class NewMain {  

   public_static void main_(String[] args) {  

       boolean[] _locker = new boolean_[101];  

       // to set all the locks to a false NOTE:  first locker is the number 0. Last locker is the 99.

       for (int_i=1;i<locker_length; i++)

       {

       locker[i] = false;

       }

       // first student opens all lockers.

       for (int i=1;i<locker.length; i++)        {

       locker[i] = true;

       }

       for(int S=2; S<locker.length; S++)

       {

          for(int k=S; k<locker.length; k=k+S)

          {

              if(locker[k]==false) locker[k] = true;

              else locker[k] = false;      

          }            

       }

       for(int S=1; S<locker.length; S++)

       {

           if (locker[S] == true) {

               System.out.println("Locker " + S + " Open");

           }

         /* else {

               System.out.println("Locker " + S + " Close");

           } */

       }

   }

}

5 0
1 year ago
This program finds the sum and average of three numbers. What are the proper codes for Lines a and b?
Gennadij [26K]

Answer:

The Proper codes in Line a and Line b is given below

average=Sum/3  

print (" Average is = ", average)

Explanation:

In the given question it calculated the sum but the program does not calculate the average of the 3 numbers.The average of the 3 number is calculated by using average=Sum/3   statement so we add this code in Line a then After that print the value of average by using the print function so we add this code in Line b.

4 0
1 year ago
Read 2 more answers
Rupa would like to quickly insert a table into her document without having to worry about formatting the data in the table. Whic
USPshnik [31]
Internet tap and log on application
6 0
1 year ago
Read 2 more answers
Other questions:
  • Which of the following is not a benefit of active listening?
    8·1 answer
  • Gaven's instructor told him to include a personal statement in his work portfolio. Why did his instructor recommend including a
    6·1 answer
  • In 2–3 sentences, describe how you would change the background of a group of cell
    6·2 answers
  • Isabel is creating a wireframe. She has drawn a layout for the home page along with outlining the navigation elements. She now w
    15·2 answers
  • Database management systems are expected to handle binary relationships but not unary and ternary relationships.'
    7·1 answer
  • Software as a Service (SaaS) refers to the use of computing resources, including software and data storage, on the Internet rath
    13·1 answer
  • An entrepreneur is opening a computer store in a small town and wants to display a few laptops in the store, but is concerned ab
    11·2 answers
  • A computer with a 240-watt power supply is connected to a 120 V circuit and is left on continuously for one month (31 days). How
    9·1 answer
  • Which of the following Teacher Tips would NOT be helpful when trying to select content from the Chrome Web Store? "Can be used a
    9·1 answer
  • 3. Write a program to find the area of a triangle using functions. a. Write a function getData() for user to input the length an
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!