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
QveST [7]
4 years ago
14

Write a function MaxMagnitude with two input parameters, that returns the largest-magnitude value. If the inputs are 5 7, the fu

nction returns 7. 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. Use the function in a program that takes two integer inputs, and outputs the largest-magnitude value.
Computers and Technology
1 answer:
irakobra [83]4 years ago
6 0

Answer:

The program to this question can be given as:

Program:

#include<stdio.h> //define header file

//#include<stdlib.h> //define header file  

#include<math.h> //define header file

int MaxMagnitude (int n1, int n2) //define function.

{

 int largest_magnitude_value= 0;

 if (abs(n1) > abs(n2))  

 {  

   // largest_magnitude_value

  largest_magnitude_value= n1;

 }

 else

 {  

   //largest_magnitude_value

   largest_magnitude_value=n2;

 }

 return largest_magnitude_value; //return value.

}

int main()  //define main function  

{

 int n1,n2,x;

 //define variable.

 printf("Enter first number :");

 //message

 scanf("%d",&n1);

 //input first value from user

 printf("Enter second number :");

//message

 scanf("%d",&n1);

    //input second value from user

 x=MaxMagnitude(n1, n2);  

//variable holds function return value

 printf("largest magnitude value  is =%d",x);

 //print value.

 return 0;

}

Output:

Enter first number : 5

Enter second number : 7

largest magnitude value is =7

Explanation:

The description of the above C program can be given as:

  • the above program firstly we define the header file in this we define the "math.h" header file that is a part of the "stdlib.h" that stands for standard library. This file includes math function, memory allocation, process control, and others.
  • Then we define a function that is "MaxMagnitude()" function.The return type of this function is int. I this function we pass two integer values that use the conditional statement to check which value is greater. In if block we use the absolute() function that returns an absolute value that holds in a variable that is "largest_magnitude_value".
  • Then we define the main function. In this, we define 3 integer variable that is n1,n2, and x. In the n1 and n2, we take value form the user and pass the value to the function in calling time and use x variable to print function return value.
You might be interested in
A hot site consists of computers, devices, and connectivity necessary to rebuild a network exist, but without appropriate config
andreyandreev [35.5K]

Answer:

False.

Explanation:

Hot site :- It is a backup service it is always working it allows a enterprise to continue  it's computer and network operations in case of a equipment or computer disaster. A hot site contains all the equipment required for the business to continue it's working, including space for office,furniture, telephone jacks and computer equipment with appropriate configuration.

4 0
3 years ago
Becca is working on a program that will store data. The program will need quick access to data and data persistence is not impor
tester [92]

Answer:

A developer wants to take existing code written by another person and add some features specific to their needs.

Explanation:

pls Mark as Brain list

3 0
3 years ago
For homework, we were given this photo and to figure out what it is. It is up close and labelled “ too close to tell” but I have
dalvyx [7]
I honestly have no idea on what this is... but im guessing its some sort of tool or food in somebodys mouth... probably isn't but oh well..
7 0
3 years ago
Which is the most efficient way to insert a circle into a slide?
Alinara [238K]
Go to insert < shapes < ellipses < get yer circle
8 0
3 years ago
Select the correct statement(s) regarding direct sequence spread spectrum (DSSS) and orthogonal frequency division multiplexing
Arada [10]

Answer:

a. OFDM is not classified as a spread spectrum technique, although OFDM has the effect of spreading the signal over a larger frequency spectrum.

Explanation:

Orthogonal Frequency Division Multiplexing is a technique in which large digital data is sent over radio waves by splitting it into multiple subcarriers. The data is then transmitted to different users who can access the files. OFDM is not a spread spectrum technique, it is based on large frequency spectrum.

6 0
3 years ago
Other questions:
  • P6. In step 4 of the CSMA/CA protocol, a station that successfully transmits a frame begins the CSMA/CA protocol for a second fr
    8·1 answer
  • To support an internet client, you must have six elements. the first three -- a computer, an operating system and tcp/ip -- are
    7·1 answer
  • Is a small file that a web server writes to the disk drive of the client computer, containing information about the user?
    8·1 answer
  • Which of the following processes should angel use to merge cells a1:d4 to create a title
    15·1 answer
  • again assume that each of the resistors in the circuit shown above has a resistance value of 100k(question in the picture above)
    9·1 answer
  • Which module is missing from most expert systems? a. Knowledge base subsystem b. Inference engine c. User interface subsystem d.
    5·1 answer
  • Fill in the blank with the correct response.
    10·1 answer
  • What’s an input Device
    7·2 answers
  • Explain what the loop does and what the result of executing it will be.
    7·1 answer
  • ____ loses data when it stops receiving electrical power.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!