import java.util.Scanner;
public class GirilenSayilardanMinveMaxDeğerleriBulma {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.print("kaç sayı gireceksiniz: ");
int a=input.nextInt();
int max=0,min=0,b=0;
for(int i=1;i<=a;i++) {
System.out.print( i +".sayıyı giriniz: ");
b=input.nextInt();
max=b;
min=b;
}if(b >max) {
max=b;
}else if(b<min) {
min=b;
}else {
System.out.print( "sayılar eşit.");
}
System.out.print(max);
System.out.print(min);
}
}
I want to Find the Largest (MAX) and Smallest (MIN) Number Typed by the User in Java, but I'm making a mistake somewhere. i would be glad if you would support.by the way, I just want to use loop.
I took a number from the user and asked how many times to enter it. after entering the numbers, there is a calculation error and he gets the last number. max and min throw the last number to the value.thank you