AOJ volume10008 A / B Problem
import java.util.Scanner; public class ABProblems { public static void main(String[] args) { Scanner sc = new Scanner(System.in); //簡単のため入力のチェックは行わない int a = sc.nextInt(); int b = sc.nextInt(); //除算の商を求める int d = 0; if(b != 0){ d = a / b; } else{ System.out.println("ゼロ除算"); System.exit(0); } //除算のあまりを求める int r = a % b; //除算の商を求める double f = (double)a / (double)b; //結果を出力する System.out.printf("%d %d %.5f", d, r, f); } }