Java a function that returns the maximum value in a float a

Java , a function that returns the maximum value in a float array

Write a function getMax(float a[]) that returns the maximum value in a float array a[]. float getMax(float a[]) (We will assume a has at least one element)

Solution

//Function getMax() that returns maximum value in a float array public static float getMax(float a[]) { float maxValue=array[0]; //store 1st value of array in maxValue for(int i=1;imaxValue) { maxValue=array[i]; } } return maxValue; }
Java , a function that returns the maximum value in a float array Write a function getMax(float a[]) that returns the maximum value in a float array a[]. float

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site