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

Suppose you are provided with an array of integer values. Write pseudocode for a program to...
Suppose you are provided with an array of integer values. Write pseudocode for a program to determine how many unique values are in the array. Your solution should require time that is linearithmic in the size of the array. (For example, if the array contains the values {1,3,4,1,2}, the answer is "4", because the array contains the values 1, 2, 3, and 4)
Create a Java program with a method that searches an integer array for a specified integer...
Create a Java program with a method that searches an integer array for a specified integer value **(see help with starting the method header below). If the array contains the specified integer, the method should return its index in the array. If not, the method should throw an Exception stating "Element not found in array" and end gracefully. Test the method in main with an array that you make and with user input for the "needle". starting header ** public...
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...
Write a program to read in a collection of integer values, and find and print the...
Write a program to read in a collection of integer values, and find and print the index of the first occurrence and last occurence of the number 12. The program should print an index value of 0 if the number 12 is not found. The index is the sequence number of the data item 12. For example if the eighth data item is the only 12, then the index value 8 should be printed for the first and last occurrence....
Make a program that swaps the three values. Three integer values are taken from the user...
Make a program that swaps the three values. Three integer values are taken from the user input. This work will be done by calling the function "getinput(num1, num2, num3)" The input values are swapped each other by calling the function swap(num1, num2, num3) example: values (a, b, c) will be (c, a, b) after the swap. a = 10; b = 20; c = 30; after function call, a has 30, b has 10, and c has 20.
Make a python code. Write a function named max that accepts two integer values as arguments...
Make a python code. Write a function named max that accepts two integer values as arguments and returns the value that is the greater of the two. For example, if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is the greater of the two. Write the program as a loop that...
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_____
Write a method with the following header to return an array of integer values which are...
Write a method with the following header to return an array of integer values which are the largest values from each row of a 2D array of integer values public static int[] largestValues(int[][] num) For example, if the 2D array passed to the method is: 8 5 5 6 6 3 6 5 4 5 2 5 4 5 2 8 8 5 1 6 The method returns an array of integers which are the largest values from each row...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT