Здражейте. Имам проблем със задачата Data Types and Variables Coding Tasks.
условието е Arithmetics
Read two numbers from the console and calculate:
- The sum of a and b
- The difference when a is subtracted from b
- The product of a and b
- The remainder when a is divided by b
- The result of a powered to b
Моля код е
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String number1 = scanner.nextLine();
String number2 = scanner.nextLine();
int a = Integer.parseInt(number1);
int b = Integer.parseInt(number2);
System.out.println(a + b);
System.out.println(a - b);
System.out.println(a * b);
System.out.println(a % b);
System.out.println(a *= b);
}
}
Получаввамгрешен отговор при две от проверките. Благодаря.