Question

I am supposed to a pseudocode function named max that accepts two integer values as arguments...

I am supposed to a pseudocode function named max that accepts two integer values as arguments and returns the value that is greater of the two. Use the function in a program that prompts the user to enter two integer values. The program should display the value that is greater of the two.

Is everything correct and complete?

//Pseudocode
//This function takes two integers as parameters: x and y

Begin : Max(x,y)
If(x>y) then
MAX=x

Else

MAX=y

End if
Return MAX
End Max()


//Declare necesarry variable
declare function main
declare integer x
declare integer y

//Get value of x
display "Enter value of x"
input x

//Get value of y
display "Enter value of y"
input y

//Calculate max
larger = max(x,y)

//Display max
display larger
end main

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Pseudocode: Max()

Input:the function takes two integers as parameters: x and y

Output: the function returns the greatest of the two integers as “MAX”

  1. Begin : Max(n1,n2)
  2. If(n1>n2) then

     MAX=n1

Else

      MAX=n2

  1. End if
  2. Return MAX
  3. End Max()

Pseudocode: inputnumber()

Input: no arguments are passed to this functions

Ouput:This function returns the number provided by the user.

1. Begin :inputnumber()

2.   Prompt:Enter any number

3. store the given number in variable “num”

4.    return num

5. end inputnumber()

Pseudocode:main()

  1. Begin main()
  2. Declare two variables x and y
  3. Display “enter first number:”
  4. //function to enter value of x
  5. x= inputnumber()
  6. Display x
  7. //function to enter value of y
  8. Display ”enter second number”
  9. y=inputnumber()
  10. Display y
  11. larger=Max(x,y)
  12. Display larger
  13. End main.
Add a comment
Know the answer?
Add Answer to:
I am supposed to a pseudocode function named max that accepts two integer values as arguments...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Design a function named max that accepts two integer values as arguments and returns the value...

    Design 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. Need Variable lists, Psuedocode, ipo chart, Flow Chart, and a python...

  • Python problem QUESTION 48 Write a function named was that accepts two integer values as arquments...

    Python problem QUESTION 48 Write a function named was that accepts two integer values as arquments and returns the wake that is greater of the two for example, if 7 and 12 are passed as arguments the function should return 12. If the arguments are equal the function should return zero. TTTA 3112) T V 2

  • 9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments

    9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should return a pointer to the new array. Demonstrate the function by using it in the main program that reads an integer N  (that is not more than 50) from standard input and then reads N  integers from a file named...

  • (C++) Write a function that accepts an int array and the array’s size as arguments. The function...

    (C++)Write a function that accepts an int array and the array’s size as arguments.The function should create a new array that is twice the size of the argument array.The function should copy the contents of the argument array to the new array, and initialize the unused elements of the second array with 0.The function should return a pointer to the new array.Demonstrate the function by using it in a main program that reads an integer N (that is not more...

  • 1. The following program calls the function countLarger that accepts three arguments: an integer array, an...

    1. The following program calls the function countLarger that accepts three arguments: an integer array, an integer size that indicates how many elements are in the array, and an integer n. The function countLarger should return the number of integers in the array that are greater than the value of the argument n. Update the program to include the definition of the function countLarger. #include <iostream> using namespace std; int countLarger(int[], int, int); // Function prototype int main() const int...

  • Experiment with the arguments in the max() function in the program to determine if the function must have four arguments.

    1.   Experiment with the arguments in the max() function in the program to determine if the function must have four arguments. Provide an example for your answer.2. Write code that prompts the user for a floating point number and prints the smallest integer that is larger than the number the user entered.                           3.         Write the code to print a random number between one and six.     4.         Assume that a user enters any number and that the number is stored in the...

  • PYTHON QUESTION PLEASE!! Write a function named problem3 that accepts two strings as the arguments, returns...

    PYTHON QUESTION PLEASE!! Write a function named problem3 that accepts two strings as the arguments, returns the characters that occur in both strings. Test case: the arguments are “apple@123” and “banana@#345”, your program should return “a@3”. Write a function named problem3 that accepts two strings as the arguments, returns the characters that occur in both strings. (20 pts) Test case: the arguments are "apple@123” and “banana@#345”, your program should return "a@3".

  • Using Java: 1. Recursive Multiplication Write a recursive function that accepts two arguments into the parameters...

    Using Java: 1. Recursive Multiplication Write a recursive function that accepts two arguments into the parameters x and y. The function should return the value of x times y. Remember, multiplication can be performed as repeated addition as follows: 5×6=6+6+6+6+6 2. Recursive findings Write a recursive boolean method named reFinding. The method should search an array for a specified value, and return true if the value is found in the array, or false if the value is not found in...

  • C++ Programming 1. Write a function (header and body) that accepts an integer as an argument...

    C++ Programming 1. Write a function (header and body) that accepts an integer as an argument and returns that number squared. 2. Write the code that will fill an integer array named multiples with 10 integers from 5 to 50 that are multiples of five. (This should NOT be in the form of an initialization statement.) 3. Write the code that will display the contents of the integer array named multiples. Recall: the size of the array is 10. 4....

  • Task 4: a) Write a function named change() that has an integer parameter and six integer...

    Task 4: a) Write a function named change() that has an integer parameter and six integer reference parameters named hundreds, fifties, twenties, tens, fives, and ones. The function is to consider the passed integer value as a dollar amount and convert the value into the fewest number of equivalent bills. Using the reference parameters, the function should alter the arguments in the calling function. b) Include the function written in part a in a working program. Make sure your function...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT