Hi, i have an array with float numbers.
How do I find the largest number in the array? Thanks.
Hi, i have an array with float numbers.
How do I find the largest number in the array? Thanks.
int largest = 0;
for (int i = 0; i < myArray.Length; i++) {
if (myArray[i] > myArray[largest])
largest = i;
}
myArray[largest] - will contain the largest value
largest - will contain the array index of the largest value
That’s an extremely trivial problem which leads me to believe that you would benefit from reading a basic programming book, not to demean you or anything, just some constructive criticism.
ok. thanks