程式碼:
import java.util.Scanner;
public class a244_新手訓練_for_if {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int m;
int a, b, c;
int sum;
while(input.hasNext()) {
m = input.nextInt();
for(int i = 0; i < m; i++) {
a = input.nextInt();
b = input.nextInt();
c = input.nextInt();
if(a == 1)
System.out.println("" + (b + c));
else if(a == 2)
System.out.println("" + (b - c));
else if(a == 3)
System.out.println("" + (b * c));
else if(a == 4)
System.out.println("" + (b / c));
}
}
}
}