Answer:
Algorithm for finding maximum
Let the 3 numbers be x,y and z.
- First find maximum between x and y using if statement.
- if x is greater than y then compare x with z.If x is greater than z then x is maximum.Else z is maximum.
- if x is smaller than y compare y with z.If y is greater than z then y is maximum else z is maximum.
Algorithm for finding minimum
- First compare x with y.
- If x is larger than y then compare y with z.If z is smaller then minimum is z else it is y.
- If x is smaller then compare x with z.If z is smaller then z is minimum else it is x.
Algorithm for finding the average
- Initialize a double variable to store the result and an integer to store the sum.
- Assign the value sum/3 to the result and it is our average.