-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.java
More file actions
34 lines (31 loc) · 951 Bytes
/
Copy pathtest.java
File metadata and controls
34 lines (31 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package FindMinMaxNumbers;
import java.util.Scanner;
/**
* @author Fatih ARI - 20.08.2021
*
* The program is designed to find the min and max values from N numbers entered by the user.
*
*/
public class test {
public static void main(String[] args)
{
int max = 0, min = 9999;
Scanner input = new Scanner(System.in);
System.out.print("How many numbers will you enter? : ");
byte count = input.nextByte();
int i=0;
while(i!=count)
{
System.out.print("Enter number "+ (i+1)+": ");
int number = input.nextInt();
if(number>max)
max = number;
if(number<min)
min = number;
i++;
}
input.close();
System.out.println("\nThe maximum number is: " + max);
System.out.println("The minimumum number is: " + min);
}
}