I wrote this basic code, confident it was going to work. I see think it should work but for some reason it hasn't lol I was wondering if you guys can tell me what i did wrong. This is just a code to output the largest amount in an array. I have already created the array.
int index = array.length -1;
int i, n, largest;
largest = array[0];
for(i=0;i < index;i++)
if(array[i] > array[i + 1])
largest = array[i];
System.out.println(array[i]);
Any help on what i did wrong?
from Newest questions tagged java - Stack Overflow http://ift.tt/1fE8KYe
via IFTTT
Aucun commentaire:
Enregistrer un commentaire