Hi can someone help me. Di ko madidisplay yung numbers. Yun nalang kulang huhu. Please help me
Heres my code:
import java.util.Scanner;
class Main {
public static void main(String[] args) {
int count;
int items = 5;
int newnum =0 ;
int highest=0;
int lowest =0;
Scanner input = new Scanner(System.in);
System.out.print("Input 5 numbers: ");
for (count=0; count<items; count++){
newnum= input.nextInt();
if (highest<newnum)
highest=newnum;
if (lowest==0)
lowest=newnum;
else if (newnum<=lowest)
lowest=newnum;
}
System.out.println("Highest value: "+highest);
System.out.println("Lowest Value: "+lowest);
}
}
Heres my code:
import java.util.Scanner;
class Main {
public static void main(String[] args) {
int count;
int items = 5;
int newnum =0 ;
int highest=0;
int lowest =0;
Scanner input = new Scanner(System.in);
System.out.print("Input 5 numbers: ");
for (count=0; count<items; count++){
newnum= input.nextInt();
if (highest<newnum)
highest=newnum;
if (lowest==0)
lowest=newnum;
else if (newnum<=lowest)
lowest=newnum;
}
System.out.println("Highest value: "+highest);
System.out.println("Lowest Value: "+lowest);
}
}
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.