Last active
January 20, 2022 23:26
-
-
Save smyy96/e9e3ea0f3d1c044efab08cb4e38f182b to your computer and use it in GitHub Desktop.
Patika Java 101 - Hesap Makinesi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class HesapMakinesi { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
int sayi1,sayi2, secim; | |
System.out.print("İlk sayıyı giriniz :"); | |
sayi1=input.nextInt(); | |
System.out.print("İkinci sayıyı giriniz :"); | |
sayi2=input.nextInt(); | |
System.out.print("1.Toplama \n2.Çıkarma \n3.Çarpma \n4.Bölme\n"); | |
System.out.print("Seçiminiz :"); | |
secim=input.nextInt(); | |
switch (secim) | |
{ | |
case 1: | |
System.out.print("Toplama: "+(sayi1+sayi2)); | |
break; | |
case 2: | |
System.out.print("Çıkarma: "+(sayi1-sayi2)); | |
break; | |
case 3: | |
System.out.print("Çarpma: "+(sayi1*sayi2)); | |
break; | |
case 4: | |
if(sayi2!=0) | |
System.out.print("Bölme: "+(sayi1/sayi2)); | |
else | |
System.out.println("Sıfıra Bölünemez"); | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment