import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); int nums = scan.nextInt(); System.out.print(num/nums + " " + num%nums); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { //键盘录入两个整数 Scanner in = new Scanner(System.in); while(in.hasNextInt()){ int a = in.nextInt(); int b = in.nextInt(); // 引用变量来统计余数 int count=0; // 被除数/除数=商的运算逻辑(利用while语句) while(a>=b){ a=a-b; count++; //被除的次数 } System.out.println((count)+" "+(a)); } } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a=scanner.nextInt(); int b=scanner.nextInt(); System.out.printf("%d %d",a/b,a%b); } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int aNum = scanner.nextInt(); int bNum = scanner.nextInt(); if(bNum == 0){ System.out.println("Error"); }else{ System.out.println(aNum / bNum + " " + aNum % bNum); } } }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); System.out.println(a/b+" "+a%b); } }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner in = new Scanner(System.in); String[] num = in.nextLine().split(" "); //Integer.valueOf():将字符串类型转为Integer类型 int a = Integer.valueOf(num[0]); int b = Integer.valueOf(num[1]); System.out.println(a/b+" "+a%b); } }
import java.util.*; public class Main { public static void main(String [] args) { Scanner sc=new Scanner(System.in); while(sc.hasNextLine()) { String str=sc.nextLine(); String [] arr=str.split(" "); int a=Integer.parseInt(arr[0]); int b=Integer.parseInt(arr[1]); System.out.print(a/b+" "); System.out.println(a%b); } } }