import java.io.*;
public class sample1 {
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int smallest = 0, value = 0, val;
String input;
System.out.print("How many Integers you want to Input:?");
val = Integer.parseInt(in.readLine());
for ( int x = 1; x <= val; x++ ) {
System.out.print("Enter Integer no"+x+" : ");
value = Integer.parseInt(in.readLine());
if ( x == 1 )
smallest = value;
else if ( value < smallest )
smallest = value;
}
System.out.println("Smallest Integer is: "+smallest);
}
}
Walang komento:
Mag-post ng isang Komento