Hi,
im a java programmer biginner,
i have been trying to print out the lowest and largest number from user input of 5 digit. here is my code below. can anyone please assist
import java.util.Scanner;
public class LowestLargest{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int number1;
int number2;
int number3;
int number4;
int number5;
int result;
int lowest;
//int highest;
System.out.println("Enter first integer");
number1 = input.nextInt();
System.out.println("Enter second integer");
number2 = input.nextInt();
System.out.println("Enter third integer");
number3 = input.nextInt();
System.out.println("Enter forth integer");
number4 = input.nextInt();
System.out.println("Enter fifth integer");
number5 = input.nextInt();
result = number1 & number2 & number3 & number4 & number5;
lowest = number1 & number2 & number3 & number4 & number5;
if(lowest < result){
System.out.printf("lowest %d is lowest integer", result);
}else{
System.out.printf("highest = %d is highest integer", result);
}
}
}