java每日一练:输入两个整数,计算和与差
package com.company;
import java.util.Scanner;
//输入两个整数,计算它们的和与差
public class Test1 {
public static void main(String[] args) {
int a = 0;
int b = 0;
Scanner scanner = new Scanner(System.in);
System.out.print("请输入第一位数:");
a = scanner.nextInt();
System.out.print("请输入第二位数:");
b = scanner.nextInt();
System.out.println("两数之差:"+ (a-b));
System.out.println("两数之和:" + (a+b));
}
}