package algorithmsample29;
import java.util.Scanner;
/**
*
* @author Nurhak
*/
public class AlgorithmSample29 {
public static void main(String[] args) {
int number = 0;
int biggestNumber = 0;
int smallestNumber = 0;
String data = "";
try {
Scanner scan = new Scanner(System.in);
for (int i = 1; i <= 10; i++) {
System.out.println("Enter the number " + i);
data = scan.nextLine();
number = Integer.parseInt(data);
if (number > biggestNumber) {
biggestNumber = number;
}
if (number < smallestNumber) {
smallestNumber = number;
}
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("----------------");
System.out.println("The biggest number is: " + biggestNumber);
System.out.println("----------------");
System.out.println("The smallest number is: " + smallestNumber);
}
}
Comments
Post a Comment