POJ 2390 Bank Interest

简介: Problem Description Farmer John made a profit last year! He would like to invest it well but wonders how much money he will make.

Problem Description
Farmer John made a profit last year! He would like to invest it well but wonders how much money he will make. He knows the interest rate R (an integer between 0 and 20) that is compounded annually at his bank. He has an integer amount of money M in the range 100..1,000,000. He knows how many years Y (range: 0..400) he intends to invest the money in the bank. Help him learn how much money he will have in the future by compounding the interest for each year he saves. Print an integer answer without rounding. Answers for the test data are guaranteed to fit into a signed 32 bit integer.

Input
* Line 1: Three space-separated integers: R, M, and Y

Output
* Line 1: A single integer that is the number of dollars FJ will have after Y years.

Sample Input
5 5000 4

Sample Output
6077

#include <stdio.h>
#include <stdlib.h>

int main(){
    int y;
    double r,m;
    scanf("%lf%lf%d",&r,&m,&y);
    int i;
    for(i=0;i<y;i++){
        m+=m*(r/100.0);
    }
    int a=(int)m;
    printf("%d\n",a);
    return 0;
}
目录
相关文章
|
Ubuntu 网络安全
【ubuntu】目录下文件太多导致rm指令无法执行问题解决方法
【ubuntu】目录下文件太多导致rm指令无法执行问题解决方法
168 0
|
编译器 C++
C++零基础教程(什么是多态)
C++零基础教程(什么是多态)
102 0
|
Java API
关于Java常量定义的一点思考
关于Java常量定义的一点思考
4064 0
|
资源调度 前端开发 数据格式
React 组件之间到底是如何进行通讯的?
​ 组件是独立且封闭的单元,默认情况下,只能使用组件自己的数据。在组件化过程中,我们将一个完整的功能拆分成多个组件,以更好地完成整个应用的功能。而在这个过程中,多个组件之间不可避免的要共享某些数据。为了实现这些功能,就需要打破组件的独立封闭性,让其与外界沟通。这个过程就是组件通讯。
124 1
|
Java
Java 最常见面试题:ArrayList 和 LinkedList 的区别是什么?
Java 最常见面试题:ArrayList 和 LinkedList 的区别是什么?
191 0
|
Oracle 关系型数据库
oracle学习62-oracle之set运算符和练习
oracle学习62-oracle之set运算符和练习
168 0
oracle学习62-oracle之set运算符和练习
|
前端开发
Bootstrap系列 -- 9. 表格
一. Bootstrap 表格样式支持   Bootstrap提供了六种不同风格的样式支持,其中一个基础样式,4个附件样式,1个响应式设计样式   1. .table:基础表格   2. .
1223 0

热门文章

最新文章