Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package cc.openhome;
- import java.math.BigDecimal;
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner com=new Scanner(System.in);
- System.out.printf("減法運算\n");
- //字串處理運算宣告(可運算數值擴大且為精確運算
- BigDecimal []op;
- op=new BigDecimal[5];
- System.out.printf("請輸入數字a:");
- op[0]=new BigDecimal(com.next());
- System.out.printf("請輸入數字b:");
- op[1]=new BigDecimal(com.next());
- System.out.printf(" a-b= %.2f\n",op[0].subtract(op[1]));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement