My program is showing correct output but its not fulfilling third condition .What is the error in the program ?
package com.codegym.task.task07.task0721;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
Min and max in arrays
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int[] a=new int[20];
for(int i=0;i<20;i++){
a[i]=Integer.parseInt(reader.readLine());
}
int maximum=0;
int minimum=0;
int e=a[0]; //write your code here
int s=a[0];
for(int i=1;i<a.length;i++){
if(s>a[i]){
s=a[i];
minimum=s;
}
}
for(int i=1;i<20;i++){
if(e<a[i]){
e=a[i];
maximum=e;
}
}
System.out.print(maximum + " " + minimum);
}
}