-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathenBuyukİkiSayi.java
More file actions
38 lines (27 loc) · 866 Bytes
/
enBuyukİkiSayi.java
File metadata and controls
38 lines (27 loc) · 866 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
35
36
37
38
package projeler3;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class enBuyukİkiSayi {
public static void main(String[] args) {
/*
*
* SORU 6 :
*
* KLAVYEDEN GİRİLEN 10 TANE SAYİ ARASINDA EN BÜYÜK İKİSİNİ YAZDIRAN PROGRAM.
*
*
*/
int sayi;
Scanner input = new Scanner(System.in);
ArrayList<Integer> enBuyukİkiIntegers = new ArrayList<>();
for (int counter = 0; counter < 10; counter++) {
System.out.print("10 Tane Sayi Giriniz : ");
sayi = input.nextInt();
enBuyukİkiIntegers.add(sayi);
}
Collections.sort(enBuyukİkiIntegers);
Collections.reverse(enBuyukİkiIntegers);
System.out.println("\n\nGIRILEN 10 SAYI1DAN EN BUYUK IKISI : " + enBuyukİkiIntegers.get(0) + " ve "+ enBuyukİkiIntegers.get(1));
}
}