Question

In: Computer Science

pseudocode The main( ) program passes these integer values as arguments to the findMax( ) method...

pseudocode The main( ) program passes these integer values as arguments to the findMax( ) method for further processing. The main program receives one result back from findMax( ) method and displays the maximum of these three integer values. The findMax( ) method simply receives three integer values from the main program and finds the maximum of three integers and returns one value back to the caller (in this case the main application).

Solutions

Expert Solution

here is the answer..

CODE:

#include<stdio.h>
int findMax(int a,int b,int c)
{
   if(a>b && a>c)
       return a;
   else if(b>c)
       return b;
   else
       return c;
}
int main()
{
   int a,b,c;
   printf("ENter 3 number :");
   scanf("%d%d%d",&a,&b,&c);
   printf("Max : %d",findMax(a,b,c));
}

OUTPUT:

PSUEDOCODE:

-> Read 3 numbers

-> call finMax() with 3 numbers

-> check if first number greater than other two numbers

->return first number

-> check second number greater than third

-> return second number

->return third number.

If you have any doubts please COMMENT...

If you understand the answer please give THUMBS UP.....


Related Solutions

Write a program that contains a main method and another method named userName. The main method...
Write a program that contains a main method and another method named userName. The main method should prompt the user to enter a full name. The userName method takes the full name as an argument and prints the name in reverse order and returns the number of characters in the name. See Sample Output (input shown in blue). Sample Output Please enter your FULL name Billy Joe McCallister Here is the name Billy Joe McCallister in reverse: retsillaCcM eoJ ylliB...
4. Write a program trace for the pseudocode in Exercise • E4.6, assuming the input values...
4. Write a program trace for the pseudocode in Exercise • E4.6, assuming the input values are 4 7 –2 –5 0. Ans. first value minimum output • E4.6 --> This is the pseudocode Set a Boolean variable "first" to true. While another value has been read successfully If first is true Set the minimum to the value. Set first to false. Else if the value is less than the minimum Set the minimum to the value. Print the minimum.
assume that the following pseudocode is executed in a program module main declare x = 1...
assume that the following pseudocode is executed in a program module main declare x = 1 declare sum = 0 declare max = 5 while ( x < max) Display "x is ", x set x = x + 1 set sum = s + x end while end module after the execution of this program the final value of x is_____ and the final value of sum is_____
IN JAVA Write a MAIN METHOD that asks for user input of a positive integer and...
IN JAVA Write a MAIN METHOD that asks for user input of a positive integer and a negative integer validates the inputs using a loop and then calls the METHOD from Question 3 and prints the result. The MAIN should have two variables (appropriately typed), get the input from the user and store them in the variables after validating them, then call the method from question 3 (sending parameters, if necessary) and print the returned value with an appropriate descriptive...
Write a Java program that prompts the user to enter a list of integer values and...
Write a Java program that prompts the user to enter a list of integer values and displays whether the list is sorted in increasing order or not. Here is a sample run. Note that the first number in the input indicates the number of the elements in the list. <Output> Enter list: 8 101516619111 The list is not sorted <End Output <Output> Enter list: 10 11344579 11 21 The list is already sorted <End Output Create a complete class for...
c++ Write a program that will ask the user for three pairs of integer values. The...
c++ Write a program that will ask the user for three pairs of integer values. The program will then display whether the first number of the pair is multiple of the second. The actual work of making the determination will be performed by a function called IsMultiple that takes two integer arguments (say, x and y). The function will return a Boolean result of whether x is a multiple of y.
Analyze the case using Giving Voice to Values, What are the main arguments Kevin is trying...
Analyze the case using Giving Voice to Values, What are the main arguments Kevin is trying to counter? What are the reasons and rationalizations Kevin needs to address?
Using the main function’s arguments, create a program that takes in a person’s name, their home...
Using the main function’s arguments, create a program that takes in a person’s name, their home town/location, and cell number then prints out the following message: Sample run 1: Java lab01_task03 Sililo Uis 0819876543 Output:   Contact successfully saved !! Contact Name : Sililo @ Uis Home number: 0819876543
Write in main • setArray() – This method has two integer parameters, one for the rows...
Write in main • setArray() – This method has two integer parameters, one for the rows of a two-dimensional array and the other for the columns of a two-dimensional array. The method will return a two-dimensional array of integers with rows and columns given by the parameters. In addition, the method will use the Random class, along with the nextInt() method, to give each element of the two-dimensional array a value between 1 and 20. • display() – This is...
write a python program that inputs 10 integer values from the keyboard and then displays their...
write a python program that inputs 10 integer values from the keyboard and then displays their sum. use for loop
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT