-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDortIslem.java
More file actions
58 lines (44 loc) · 1.69 KB
/
DortIslem.java
File metadata and controls
58 lines (44 loc) · 1.69 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package dortıslem;
import java.util.Scanner;
public class DortIslem {
public static void main(String[] args) {
double toplama, cikartma, carpma, bolme;
String islemler = "1-Toplama \n"+
"2-Çıkartma\n"+
"3-Çarpma\n"+
"4-Bölme\n"+
"Çıkış için q ya basınız...";
System.out.println("A ve B değerlerini giriniz...");
Scanner scan = new Scanner(System.in);
System.out.print("A: ");
double a = scan.nextDouble();
System.out.print("B: ");
double b = scan.nextDouble();
System.out.println("*****************");
System.out.println(islemler);
System.out.println("*****************");
while(true){
System.out.print("İşlemi seçiniz: ");
islemler = scan.nextLine();
if(islemler.equals("q")){
System.out.println("Programdan çıkılıyor...");
break;
}
else if (islemler.equals("1")){
System.out.println("A+B =" + (a+b));
}
else if (islemler.equals("2")){
System.out.println("A+B="+ (a-b));
}
else if (islemler.equals("3")){
System.out.println("A*B="+ (a*b));
}
else if (islemler.equals("4")){
System.out.println("A/B="+ (a/b));
}
else{
System.out.println("Geçersiz işlem...");
}
}
}
}