Advertisement
Guest User

Untitled

a guest
Jun 13th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. package ru.koshkina;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner in = new Scanner(System.in);
  8.         System.out.println("Введите первое число: ");
  9.         int x = in.nextInt();
  10.         System.out.println("Введите второе число: ");
  11.         int y = in.nextInt();
  12.         if (y != 0){
  13.             int sum = x + y;
  14.             System.out.println("Сумма равна: " + sum);
  15.             int d = x - y;
  16.             System.out.println("Разность равна: " + d);
  17.             int c = x * y;
  18.             System.out.println("Произведение равно: " + c);
  19.             int q = x / y;
  20.             System.out.println("Частное равно: " + q);
  21.         }else{
  22.             int sum = x + y;
  23.             System.out.println("Сумма равна: " + sum);
  24.             int d = x - y;
  25.             System.out.println("Разность равна: " + d);
  26.             int c = x * y;
  27.             System.out.println("Произведение равно: " + c);
  28.             System.out.println("На ноль делить нельзя!");
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement