㈠ c语言编程 编程:根据本金a、存款年数n和年利率p计算到期利息。
可以参考下面的代码(a百分比下的利率,b本金,c年数):
#include<bits/stdc++.h>
#defineLDBlongdouble
usingnamespacestd;
LDBa,b;
intc;
intmain(){
scanf("%Lf%Lf%d",&a,&b,&c);
printf("%.3Lf ",pow(1+a/100.0,c)*b);
}
(1)n年利率和C语言扩展阅读:
C语言参考函数
C语言ldexp()函数:返回x乘以2的exponent次方(次幂)的值
C语言labs()函数:求整数的绝对值(针对long类型)
C语言isgraph()函数:判断一个字符是否是图形字符
C语言fabs()函数:求双精度浮点数的绝对值
C语言abs()函数:求整数的绝对值
C语言div()函数:求两个数的商和余数
C语言fmod()函数:求x/y的余数(针对浮点数)
C语言atan2()函数:求x/y的反正切值
㈡ c语言 算每年存n元利率p%多少年才会超过d 但不要用太难的打
#include"stdio.h"
int main()
{
int n,d,count=0;
double p=0.1,Pr=0; //d为利息,Pr为本金
printf("输入每年存入金额:");
scanf("%d",&n);
printf("输入d的值:");
scanf("%d",&d);
while(Pr<d)
{
Pr=(Pr+n)*(p+1);
count++;
}
printf("%d年后超过d的值\n",count);
return 0;
}
㈢ 急急急 解答有重谢 关于c语言的银行年利率 本息和的运算
#include<stdio.h>
#include<math.h>
intmain()
{
doubler=100000;
r*=pow(1.037,5);//到第五年的本息和。
r-=20000;//取出2万
r*=pow(1.037,5);//到第十年的本息和。
printf("%.2lf ",r);
return0;
}
㈣ C语言程序设计利息计算的编程: 输入年利率,本金,存款年数,设计一个算法求n年后得到的本息
#include<bits/stdc++.h>
#defineLDBlongdouble
usingnamespacestd;
LDBa,b;
intc;
intmain(){
scanf("%Lf%Lf%d",&a,&b,&c);
printf("%.3Lf ",pow(1+a/100.0,c)*b);
}
a百分比下的利率,b本金,c年数
㈤ 求助c语言编程问题。。。1。设银行定期存款年利率rate为2.25%已知存款期限为n年存款本金为c
#include<stdio.h>
int main(void)
{
double rate=0.0225;
double capital;
int years;
double deposit;
scanf("%f",&capital); //输入本金
scanf("%f",&years); //输入存储的年份
deposit=capital+(capital*rate*years);
printf("%f",deposit);
return 0;
}
㈥ 各位大神,C语言设银行的年利率是rate,存n年,本金是capital,求本利之和deposit,
删除第一个printf中的 “,capital,n" 试试。
㈦ c语言编程 银行利率问题
#include"stdio.h"
void f1(float x)
{
int n;
float y=0.75*x,sum;
for(n=1;n<15;n++)
{
x=1.08*x;
y=x*0.0075;
y+=y;
x+=x;
}
printf("存入现金%f,可得利息%f,它们之和%f",12*x,12*y,12*(x+y));
}
void f2(float x)
{
int n;
float y=0.0175*x,sum;
for(n=1;n<15;n++)
{
x+=0.08*x
y+=0.175*x;
}
printf("存入现金%f,可得利息%f,它们之和%f",12*x,12*y,12*(x+y));
}
int main()
{
printf("其多余的钱是第一年每月2000元,以后每年每月多余的钱在上一年队每月多余钱的基础上再增加8%,活期月息为0.75%,一年期月息为1.75%,三年期月息为2.15%,五年期月息为2.75%,且银行对定期存款过期部分不支付利息。");
")
printf("<<<<<<<<<<<<储蓄问答系统>>>>>>>>>>>>>>");
printf("请按数字键操作\t"):
printf("\t1.答活期15年本金与利息以及它们之和\n");
printf("\t2.答1年定期15年本金与利息以及它们之和\n");
printf("\t3.答3年定期15年本金与利息以及它们之和\n");
printf("\t4.答5年定期15年本金与利息以及它们之和\n");
printf("\t0退出\t\t5清屏");
switch(getchar())
{
case 1: f1(2000);break;
case 2: f2(2000);break;
case 3: f3(2000);break;
case 4: f4(2000);break;
case 5: system(cls");break;
case 0: exit(1);break;
}
那个其他函数类是,我就不再这里编了,时间紧急,没编译过,有问题再请教
㈧ c语言 计算定期存款本利之和
#include
<stdlib.h>
int
main(void)
{
float
rate,capital,deposit=0;
int
n;
printf("Please
input
the
rate:");
scanf("%f",&rate);
printf("Please
input
the
n:");
scanf("%d",&n);
printf("Please
input
the
capital:");
scanf("%f",&capital);
deposit=capital+capital*n*rate/100;
printf("The
deposit
is
%f
",deposit);
return
0;
}
运行结果如下:
这里需要给你解释一下,输入的时候那个利率我是直接按百分比算的,比如2.25%
就输入2.25就好,计算的时候帮你转化成小数点了,如果要输入小数点那种,capital*n*rate/100;这里的100你就自己去掉。
㈨ 用c语言表示n年后本金利息的和
这是把前一年的利息作为后一年的本金的代码。
//#include"stdafx.h"//Ifthevc++6.0,withthisline.
#include"stdio.h"
#include"math.h"
intmain(void){
doublebj,ll;//本金和利率
intn;//年数
printf("Pleaseentertheprincipal,... ");
scanf("%lf%lf%d",&bj,&ll,&n);
printf("Thetotalamountis%g ",bj*pow(1+ll,n));
return0;
}
㈩ c语言计算银行利息
#include<stdio.h>
#include<math.h>
intmain(){
setbuf(stdout,NULL);//eclipse需要加这段,不然运行后看不到输出
floatsum,money,year,rate;
printf("inputmoney ");//等待用户输入存款金额,回车键结束.
scanf("%f",&money);//赋值给变量money
printf("inputyear ");//等待用户输入存款期限,回车键结束.
scanf("%f",&year);//赋值给变量year
printf("inputrate ");//等待用户输入年利率,回车键结束.
scanf("%f",&rate);//赋值给变量rate
sum=money*pow(1+rate,year);//pow函数
printf("sum=%.2f",sum);//输出本息,保留小数点后两位
return0;
}