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
Ludmilka [50]
3 years ago
7

Write a program that contains three methods:

Computers and Technology
1 answer:
Reil [10]3 years ago
7 0

Answer:

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

int max (int x, int y, int z) //defining a method max that hold three parameters

{

   if(x>=y && x>=z)//defining if block that checks x is greater then y and x is greater then z

   {

       return x;//return the value x

   }

   else if(y>z)//defining else if block it check y is greater then z

   {

       return y;//return the value y

   }

   else//else block

   {

       return z;//return the value z

   }

}

int min (int x, int y, int z) //defining a method max that holds three parameters

{

if(x<=y && x<=z) //defining if block that check x value is less then equal to y and less then equal to z

{

return x;//return the value of x

}

if(y<=x && y<=z) //defining if block that check y value is less then equal to x and less then equal to z

{

return y;//return the value of y

}

if(z<=x && z<=x)//defining if block that check z value is less then equal to x  

{

return z;//return the value of z

}

return x;//return the value of z  

}

int average (int x, int y, int z) //defining average method that take three parameters

{

int avg= (x+y+z)/3;//defining integer variable avg that calculate the average

return avg;//return avg value

}

int main()//defining main method

{

   int x,y,z;//defining integer variable

   printf("Enter first value: ");//print message

   scanf("%d",&x);//input value from the user end

   printf("Enter Second value: ");//print message

   scanf("%d",&y);//input value from the user end

   printf("Enter third value: ");//print message

   scanf("%d",&z);//input value from the user end

   printf("The maximum value is: %d\n", max(x,y,z));//calling the method max

   printf("The minimum value is: %d\n", min(x,y,z));//calling the method min

   printf("The average value is: %d\n", average(x,y,z));//calling the method average

   return 0;

}

Output:

Enter first value: 45

Enter Second value: 35

Enter third value: 10

The maximum value is: 45

The minimum value is: 10

The average value is: 30

Explanation:

In the above-given code, three methods "max, min, and average" is declared that holds three integer variable "x,y, and z" as a parameter and all the method work as their respective name.

  • In the max method, it uses a conditional statement to find the highest number among them.
  • In the min method, it also uses the conditional statement to find the minimum value from them.
  • In the average method, it defined an integer variable "avg" that holds the average value of the given parameter variable.
  • In the main method, three variable is defined that inputs the value from the user end and passes to the method and print its value.      
You might be interested in
A direct link between a single ____ preserves the fine details in the cones message
son4ous [18]
A single bipolar cell....
 your answer !!

6 0
3 years ago
Explain on what you did and give on how problems as such can be avoid inthe future
iragen [17]
More info please, it is very invalid
8 0
3 years ago
An interest in supervising other workers would be useful for someone who wanted to become
Paladinen [302]

Answer:

An interest in supervising other workers would be useful for someone who wanted to become a Manager

Explanation:

A manager is person who manages work, people and who is the most responsible person in an organization. A main duty of the Manager is to focus on to allot works to their sub-ordinate, monitor the work done by each and everyone; encourages the employees who are transforming their career very well and showing their good attitude towards their work; analyze how employees cooperate to achieve the target and plan for future targets.

So a Manager monitors or supervises others work.

5 0
4 years ago
n the video, McWhorter says that “textspeak” might be a good thing for young people’s brains. Why does he think this?
ANEK [815]

As you may know people learn in different ways. Some learn by audio, hands on, and simply just reading. When he says textspeak it more than likely means the text will be read to you in a way you would understand better.

3 0
4 years ago
Jennifer recently bought a new computer to type a new manuscript she’s been working on. She also stored a lot of movies on it to
weqwewe [10]

Answer:

Declining free space on the hard drive

Explanation:

Although heat is one of the main factors that shortens the life of computer parts such as the central processing unit, the major cause of deterioration in computer performance are usually program build-up, too many files including video, music, and picture files, and other forms of viruses and malware and incompletely installed programs. This may eat up free space on the hard drive, which leads to slowness.

6 0
3 years ago
Other questions:
  • What does the dashed line in the beaker separating the two sides represent?______________________?
    13·2 answers
  • Which of the following is a useful policy to minimize waste and mistakes?
    6·1 answer
  • URGENT!!! Which statement is true with regard to bitmap images?
    6·2 answers
  • Which ipv6 static route would serve as a backup route to a dynamic route learned through ospf?
    12·1 answer
  • What is an example of a functional organizational structure?
    10·2 answers
  • Suppose you have a primary location in New York City where you main corporate servers are located. Just in case something happen
    5·1 answer
  • What is the name of a button on a website?
    11·1 answer
  • Can someone please‼️‼️❗️help me with this?<br> I got an error that I can’t figure out how to fix it.
    6·1 answer
  • Question #2
    11·1 answer
  • 4. WiFi and WiMax are used for a high-speed wireless access technology.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!