我是靠谱客的博主 美好流沙,这篇文章主要介绍天天向上实例的 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的全部内容,更多相关天天向上实例的内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(111)

评论列表共有 0 条评论

立即
投稿
返回
顶部