天天向上实例的 java-code
生活随笔
收集整理的這篇文章主要介紹了
天天向上实例的 java-code
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
package test2_10;
/** 天天向上實例*/
import java.util.Scanner;
public class Test2_10 {public static void main(String[] args) {//提示用戶輸入向上的天數和進步程度System.out.println("請輸入向上的天數>");Scanner sc = new Scanner(System.in);int upday = sc.nextInt();System.out.println("請輸入進步程度(%)>");int up = sc.nextInt();System.out.println("請輸入沒有向上的天數>");int lowday = sc.nextInt();System.out.println("請輸入退步程度(%)>");int low = sc.nextInt();//計算兩者相差多少倍double differ = Math.pow((1+0.01*up),upday)-Math.pow((1-0.01)*low,lowday);System.out.println("兩者相差>"+differ+"倍");}
}
總結
以上是生活随笔為你收集整理的天天向上实例的 java-code的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Teamview连接后不能操作
- 下一篇: 003.update窗口缩放