C Program Functions with 1D Arrays Create a program that asks the user for the size of an integer array and the elements of the array. Then, create a function with the following details: Parameters: An integer array The size of the integer array Return type - int Return value - the maximum value of the integer array   Call the function you created in the main and pass the integer array and its size to it. Make sure to store the return value in a variable so you could print it afterwards. Input 1. First line contains the size of the array 2. Succeeding lines are the elements of an array Output Enter size of array: 5 Enter element 1: 1 Enter element 2: 2 Enter element 3: 3 Enter element 4: 4 Enter element 5: 5 Maximum element: 5

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

C Program Functions with 1D Arrays

Create a program that asks the user for the size of an integer array and the elements of the array.

Then, create a function with the following details:

  • Parameters:
    • An integer array
    • The size of the integer array
  • Return type - int
  • Return value - the maximum value of the integer array

 

Call the function you created in the main and pass the integer array and its size to it. Make sure to store the return value in a variable so you could print it afterwards.

Input

1. First line contains the size of the array

2. Succeeding lines are the elements of an array

Output

Enter size of array: 5
Enter element 1: 1
Enter element 2: 2
Enter element 3: 3
Enter element 4: 4
Enter element 5: 5
Maximum element: 5
Create a program that asks the user for the size of an integer array and the elements of the
array.
Then, create a function with the following details:
. Parameters:
• Return type - int
.
Return value - the maximum value of the integer array
An integer array
The size of the integer array
Call the function you created in the main and pass the integer array and its size to it. Make
sure to store the return value in a variable so you could print it afterwards.
Input
1. First line contains the size of the array
2. Succeeding lines are the elements of an array
Output
Enter size of array: 5
Enter element 1: 1
Enter element 2: 2
Enter element 3: 3
Enter element 4: 4
Enter element 5: 5
Maximum element: 5
main.c
1
> + 16
с
Test Cases
Run Tests
Test Cases
O Test Case 1
Your Output
No Output
Expected Output
Enter size of array: 8
Enter element 1: 936
Enter element 2: 439
Enter element 3: 601
Enter element 4: 853
Enter element 5: 204
Enter element 6: 215
Enter element 7: 708
Enter element 8: 914
Maximum element: 936
O Test Case 2 Hidden
Transcribed Image Text:Create a program that asks the user for the size of an integer array and the elements of the array. Then, create a function with the following details: . Parameters: • Return type - int . Return value - the maximum value of the integer array An integer array The size of the integer array Call the function you created in the main and pass the integer array and its size to it. Make sure to store the return value in a variable so you could print it afterwards. Input 1. First line contains the size of the array 2. Succeeding lines are the elements of an array Output Enter size of array: 5 Enter element 1: 1 Enter element 2: 2 Enter element 3: 3 Enter element 4: 4 Enter element 5: 5 Maximum element: 5 main.c 1 > + 16 с Test Cases Run Tests Test Cases O Test Case 1 Your Output No Output Expected Output Enter size of array: 8 Enter element 1: 936 Enter element 2: 439 Enter element 3: 601 Enter element 4: 853 Enter element 5: 204 Enter element 6: 215 Enter element 7: 708 Enter element 8: 914 Maximum element: 936 O Test Case 2 Hidden
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,