Four arithmetic of integers (Java)

Input 2 integers, and output their sum, difference, product and accurate quotient.

Input format:
input two integers

Output format:
output the results of the four arithmetic operations in each row

Input example:
70
16

Output sample:
The corresponding output is given here. E.g:

86
54
1120
4.375

import java.util.Scanner;

public class Main {
    
    
    public static void main(String[] args) {
    
    
        Scanner sc=new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(a+b);
        System.out.println(a-b);
        System.out.println(a*b);
        System.out.println(1.0*a/b);
    }
}

Guess you like

Origin blog.csdn.net/weixin_51430516/article/details/115048411