System.out.print()内形式两种
第一种
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
scanner.close();
//write your code here......
if(a>b){
System.out.println((a+b)+" "+(a-b)+" "+(a*b)+" "+(a/b)+" "+(a%b));
}else{
System.out.println((b+a)+" "+(b-a)+" "+(a*b)+" "+(b/a)+" "+(b/a));
}
}
}
第二种百分号%形式
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
scanner.close();
//a和b的值互换
if(a<b) a=a+b-(b=a);
System.out.printf("%d %d %d %d %d",a+b,a-b,a*b,a/b,a%b);
}
}