Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.koshkina;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- System.out.println("Введите первое число: ");
- int x = in.nextInt();
- System.out.println("Введите второе число: ");
- int y = in.nextInt();
- if (y != 0){
- int sum = x + y;
- System.out.println("Сумма равна: " + sum);
- int d = x - y;
- System.out.println("Разность равна: " + d);
- int c = x * y;
- System.out.println("Произведение равно: " + c);
- int q = x / y;
- System.out.println("Частное равно: " + q);
- }else{
- int sum = x + y;
- System.out.println("Сумма равна: " + sum);
- int d = x - y;
- System.out.println("Разность равна: " + d);
- int c = x * y;
- System.out.println("Произведение равно: " + c);
- System.out.println("На ноль делить нельзя!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement