write a program to store n number of integer in an array. store and display the maximum and the min number and also find out sum of all elements and display
Answers
Answered by
0
Answer:
Good Answer
Explanation:
GEEKSFORGEEKS
Sum and Product of minimum and maximum element of an Array
Given an array. The task is to find the sum and product of the maximum and minimum elements of the given array.
Examples:
Input : arr[] = {12, 1234, 45, 67, 1}
Output : Sum = 1235
for (int i = 1; i < n; i++)
res = min(res, arr[i]);
return res;
}
// Function to find maximum element
int getMax(int arr[], int n)
{
int res = arr[0];
for (int i = 1; i < n; i++)
res = max(res, arr[i]);
return res;
}
//
{
return
Similar questions