Guest User

Untitled

a guest
Jan 21st, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.90 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class deneme {
  5.  
  6.         public static void main(String[] args) {
  7.            
  8.             double islem, birinciSayi, ikinciSayi;
  9.            
  10.             Scanner klavye = new Scanner(System.in);
  11.            
  12.             System.out.println("1 - Toplam");
  13.             System.out.println("2 - Çıkarma");
  14.             System.out.println("3 - Çarpma");
  15.             System.out.println("4 - Bölme");
  16.             System.out.println("5 - Çıkış");
  17.             System.out.println();
  18.             System.out.print("Lütfen işlem türünü seçiniz (1, 2, 3, 4, 5) : ");
  19.                        
  20.             islem = klavye.nextInt();
  21.            
  22.             while (islem != 5)  {
  23.                
  24.                 if (islem > 5)  {
  25.                                        
  26.                     System.out.print("Lütfen 1 ile 5 arasında bir sayı giriniz :  ");
  27.                     islem = klavye.nextInt();
  28.                                        
  29.                 }  
  30.                                    
  31.                
  32.                 System.out.print("1. sayıyı giriniz : ");
  33.                 birinciSayi = ((int)klavye.nextDouble());
  34.                 System.out.print("2. sayıyı giriniz : ");
  35.                 ikinciSayi = ((int)klavye.nextDouble());
  36.                
  37.                
  38.                 if (islem == 1) {
  39.            
  40.                     System.out.println("İşlem sonucu = " + ((int)(birinciSayi + ikinciSayi)));
  41.                 }
  42.                
  43.                 if (islem == 2) {              
  44.                     System.out.println("İşlem sonucu = " + ((int)(birinciSayi - ikinciSayi)));               
  45.                 }
  46.                
  47.                 if (islem == 3)  {             
  48.                     System.out.println("İşlem sonucu = " + ((int)(birinciSayi * ikinciSayi)));
  49.                 }
  50.                
  51.                 if (islem == 4)  {
  52.                     System.out.println("İşlem sonucu = " + ((birinciSayi / ikinciSayi)));
  53.                 }
  54.                
  55.                 System.out.println("Lütfen devam etmek için <Enter> tuşuna basınız!");
  56.                 klavye.nextLine();
  57.                 klavye.nextLine();
  58.  
  59.                 System.out.println("1 - Toplam");
  60.                 System.out.println("2 - Çıkarma");
  61.                 System.out.println("3 - Çarpma");
  62.                 System.out.println("4 - Bölme");
  63.                 System.out.println("5 - Çıkış");
  64.                 System.out.println();
  65.                 System.out.print("Lütfen işlem türünü seçiniz (1, 2, 3, 4, 5) : ");
  66.                        
  67.                 islem = klavye.nextInt();
  68.             }
  69.         }
  70. }
Add Comment
Please, Sign In to add comment