Skip to content

Commit 6ac484c

Browse files
Create JavaHomeworks004.md
1 parent c558e58 commit 6ac484c

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

JavaHomeworks/JavaHomeworks004.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
```java
2+
package csd;
3+
/*
4+
Bütün Code bileşenlerine ve iyileştirmelerine README dosyasından ulaşabilirsiniz...
5+
*/
6+
class App {
7+
public static void main(String [] args)
8+
{
9+
10+
Homework4.run();
11+
12+
13+
}
14+
}
15+
16+
class Homework4 {
17+
public static void run()
18+
{
19+
java.util.Scanner kb = new java.util.Scanner(System.in);
20+
System.out.printf("Bir tamsayı giriniz:");
21+
int ival = Integer.parseInt(kb.nextLine());
22+
int sum = ival,
23+
min = ival,
24+
max = ival;
25+
int sumCounter = 1;
26+
for (;;){
27+
System.out.printf("Yeni bir deger girmek istiyor musunuz?%n"
28+
+ "[Evet için 1(bir) Hayır için 0(sıfır)%n"
29+
+ "değerlerinden birini giriniz]:");
30+
ival = Integer.parseInt(kb.nextLine());
31+
if (ival == 0)
32+
break;
33+
System.out.printf("Yeni bir değer giriniz:");
34+
ival = Integer.parseInt(kb.nextLine());
35+
if (ival > 100 || ival < 0){
36+
System.out.printf("Geçersiz bir değer girdiniz%n"
37+
+ "Girilen değer [0-100] aralığında olmalıdır...");
38+
continue;
39+
}
40+
min = Math.min(ival, min);
41+
max = Math.max(ival, max);
42+
sum += ival;
43+
sumCounter++;
44+
45+
}
46+
System.out.println("Çıkış yaptınız...");
47+
System.out.printf("Toplam %d değer girildi%n",sumCounter);
48+
System.out.printf("Max = %d%n",max);
49+
System.out.printf("Min = %d%n",min);
50+
System.out.printf("Ortalama = %f%n",NumberUtil.getAverage(sum,sumCounter));
51+
52+
}
53+
54+
}
55+
```

0 commit comments

Comments
 (0)