-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtekSayilar.java
More file actions
42 lines (22 loc) · 812 Bytes
/
tekSayilar.java
File metadata and controls
42 lines (22 loc) · 812 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
39
40
41
42
package projeler3;
import java.util.Scanner;
public class tekSayilar {
public static void main(String[] args) {
/*
SORU 5 :
KLAVYEDEN GİRİLEN 10 TANE SAYİNİN İCİNDEN TEK OLANLARIN ORTALMASINI ALIP
EKRANA YAZDIRAN UYGULAMA.
*/
int sayilar, tekSayilarinToplamı = 0, sayac = 0;
Scanner input = new Scanner(System.in);
for (int counter = 0; counter < 10; counter++) {
System.out.print("10 tane sayi giriniz : ");
sayilar = input.nextInt();
if (sayilar % 2 == 1 || sayilar % 2 == -1) {
tekSayilarinToplamı += sayilar;
sayac++;
}
}
System.out.println("\n\nGIRDIGINIZ SAYILAR ARASINDA BULUNAN TEK SAYILARIN ORTALAMASI : " + tekSayilarinToplamı/sayac);
}
}