題目描述
本題要求編寫程序,計算2個正整數的和、差、積、商并輸出。題目保證輸入和輸出全部在整型范圍內。
輸入
輸入在一行中給出2個正整數A和B。
輸出
在4行中按照格式“A 運算符 B = 結果”順序輸出和、差、積、商。
樣例輸入1:
3 2
樣例輸出1:
3+2=5 3-2=1 3*2=6 3/2=1
程序如下
import java.util.Scanner;public class Main { public static void main(String[] args) { // TODO 自動生成的方法存根 Scanner in= new Scanner(System.in); int i=0; int temp []=null; temp=new int [2]; for (i=0;i<2;i++) { temp[i]=in.nextInt(); } System.out.
|
新聞熱點
疑難解答