/*********************************** If文その3(If Else If型) ************************************/ import java.util.*; public class IfElseIf03 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a,b; int sa=0; System.out.print("aはいくつ-->"); a=sc.nextInt(); System.out.print("bはいくつ-->"); b=sc.nextInt(); if ( a>b ) sa=a-b; else sa=b-a; if ( a==b ) System.out.print("aとbは同じ値です\n"); else if ( a>b ) System.out.print("aが"+sa+"大きいです\n"); else System.out.print("bが"+sa+"大きいです\n"); System.out.print("\nプログラムを終了します\n"); } }