hi everyone i have a program about the smallest and largest values that user input and the program decide which is the largest which is the smallest ,so i solved it and it worked fine but it's giving me the 2 values are the same the largest same as the smallest i would like just some help or hints comment
thanx in advance
import java.util.Scanner;
public class apples
{
public static void main(String[] args)
{
Scanner input = new Scanner( System.in);
System.out.print ("please enter your first value");
int val = input.nextInt();
int smallest = val;
int highest = val;
for (int count = 0; count < val; count++){
System.out.print ("enter the next value");
val = input.nextInt();
if (val > highest) highest = val;
System.out.printf ("the highest value is %d",val);
if (val < smallest) smallest = val;
System.out.printf("the lowest value is %d", val);
}
}}