编程语言
首页 > 编程语言> > java 常规计算

java 常规计算

作者:互联网

学习了变量后就应该会尝试去让Java进行常规的计算

下面是源码

package K;

import java.util.Scanner;

public class L {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
        System.out.println("你好");  
//      System.out.println("echo:"+in.nextLine());
      Scanner in = new Scanner(System.in);
          int price ;
          int amount ;
          System.out.println("请输入金额");
//         System.out.println(price);
         price = in.nextInt();
         System.out.println("请输入数额");
         amount   = in.nextInt();
         System.out.println(amount+"-"+price+"="+(amount-price));
//         
	}

}

 

标签:java,Scanner,price,System,常规,amount,计算,println,out
来源: https://blog.csdn.net/weixin_62608816/article/details/122779203