package com.codegym.task.task05.task0532;
import java.io.*;
/*
Task about algorithms
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader (System.in));
// System.out.println ("Enter the amount of numbers to be scanned");
int n = Integer.parseInt ( reader.readLine () );
// System.out.println ( "Entered value for n is "+n );
int leastNum[] = new int[n];
// System.out.println ("Array size is "+leastNum);
// for reading the data from keyboard least num array is declared
// this array is fed from the keyboard .
if(n > 0){
for(int i = 0; i < n ; i++){
leastNum[i]=Integer.parseInt ( reader.readLine () );
// System.out.println ("Value stored at "+ i+ "Location is"+leastNum[i]);
}
// System.out.println ("Least num length is "+leastNum.length);
int maximum = Integer.MIN_VALUE;
// System.out.println ("intial value of maximum is "+maximum);
for(int i =0 ; i < n; i++){
if(maximum < leastNum[i]){
maximum = leastNum[i];
}
}
System.out.println(maximum);
}
else if(n <= 0){
}
}
}
help me with this stupid program
Resolved
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
Cynthia
22 June 2020, 15:49
Try and remove the else if statement because it's not doing anything
0