JAVA function5

public static void money(){
    Scanner input = new Scanner(System.in);
    float l = input.nextFloat();//利率
    float r = l/100 + 1;
    float m = input.nextFloat();//本金
    int year = input.nextInt();
    float total = m;
    int i = 0;
    do {
        total = total * r;
        i++;
    }while (i<year);
    System.out.println(total);
    System.out.println((int)total);
}

猜你喜欢

转载自blog.csdn.net/weixin_44895008/article/details/89883667
今日推荐