I'm trying to make this program check what number is the highest and write it out in that order, not working for me. How would one solve this?
Code Java:
public class Upg11 { public static void main(String[] args) { int[] tal = new int[5]; System.out.print("Mata in fem heltal: "); tal[0] = Keyboard.readInt(); tal[1] = Keyboard.readInt(); tal[2] = Keyboard.readInt(); tal[3] = Keyboard.readInt(); tal[4] = Keyboard.readInt(); for (int n = 0; n < 5; n++) { int i = 1; if (tal[n] < tal[i]) { int temp = tal[n]; tal[n] = tal[i]; tal[i] = temp; } } System.out.println("Talen är " + tal[0] + " " + tal[1] + " " + tal[2] + " " + tal[3] + " " + tal[4]); } }