‘壹’ c语言编程 从银行贷款d,每月还款额为p,月利率为r,算多少月能还清。设d为300000,p为6000,r为1%.
#include <stdio.h>
#include <math.h>
int main()
{float d=300000,p=6000,r=0.01,m;
m=log10(p/(p-d*r))/log10(1+r);
printf("m=%6.2f\n",m);
return 0;
}
望采纳,谢谢
‘贰’ C语言程序题,在线等
如果log是以10为底的话,如下:如果是ln,就把下面log10改为log
#include<stdio.h>
#include<math.h>
int main()
{
int d=300000,p=6000;
double r=0.01;
double m=log10(p/(p-d*r))/(log10(1+r));
printf("还清月数:%.1f\n",m);
}
‘叁’ 有关银行贷款还贷的c语言程序
你的错误实在太多了。看代码王的程序简洁易懂
#include<stdio.h>
#include<math.h>
int main()
{
double z,k,x,monthPay,allMoney,temp=0;
int n,i;
printf("输入借款总额、贷款年限、年利率: ");
//贷款总和最好不要用int型的,int的最大值是32767,那你岂不是超了
scanf("%lf%d%lf",&z,&n,&k);
//计算n年后要还的总的钱数 pow(x,y)是在头文件math.h中的函数计算x^y
allMoney = z*pow((1+k/12),12*n);
//式子∑x(1+k/12)^i (i=0,1,2,..,n*12-1)将x提出到前面计算 temp=∑(1+k/12)^i
for(i=0; i<12*n; i++)
temp += pow((1+k/12),i);
//根据等式z(1+k/12)^(12*n) = ∑x(1+k/12)^i (i=0,1,2,..,n*12-1) 得x=allMoney/temp;
x = allMoney/temp;
printf("每月应还款:%lf", x);
}
‘肆’ C语言问题
本金加利息=本金*(1+月利率)^月数
在c里有一个乘方函数pow()
pow(a,b) 等于a的b次方
#include<stdio.h>
#include<math.h>
main()
{
doublemoney,capital;
doublerate[4]={0.009,0.01,0.0111,0.012};
intn;
printf("请输入本金和期限(年) ");
scanf("%lf%d",&capital,&n);
if(n>3)
money=capital*pow((1+rate[3]),12*n);
else
money=capital*pow((1+rate[n-1]),12*n);
printf("%d年后本金和利息合计为:%.2lf ",n,money);
}
‘伍’ C语言计算贷款问题 输出不正确
printf("money(%lf,%d)=%lf\n",loan,year,money);
‘陆’ C语言题:某客户为购房办理商业贷款,选择了按月等额本息还款方式,计算公式如下。在贷款本金(loan
#include<stdio.h>
floatcal_power(floatx,intn)
{
floatp=1.0;
while(n>0){
p=p*x;
n--;
}
returnp;
}
floatcal_money(intloan,floatrate,intmonth)
{
doubletmp;
tmp=cal_power(1+rate,month);
returnloan*rate*tmp/(tmp-1);
}
intmain(void)
{
intloan,year,month;
floatmoney,rate;
printf("Enterloan:");
scanf("%d",&loan);
printf("Enterrate:");
scanf("%f",&rate);
for(year=5;year<=30;year++){
month=12*year;
money=cal_money(loan,rate,month);
printf("money(%d,%d)=%.0f ",loan,year,money);
}
return0;
}
‘柒’ C语言问题,急,在线等
#include <stdio.h>
#include <math.h>
int main()
{float d=XXXX,p=XXXX,r=XXXX,m;
m=log10(p/(p-d*r))/log10(1+r);
printf("m=%6.2f\n",m);
return 0;
}
‘捌’ C++ C语言程序设计 题目:贷款计算器
/*
* main.c
*
* Created on: 2011-6-8
* Author: icelights
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define APR1 0.0747 /*<1年(含1年)年利率*/
#define APR2 0.0756 /*1-3年(含3年)年利率*/
#define APR3 0.0774 /*3-5年(含5年)年利率*/
#define APR4 0.0783 /*5年以上年利率*/
#define A_TO_M 1/12 /*月利率 = 年利率 / 12*/
#define RTP 12 /*Reimbursement total periods还款总期数 =年限*12*/
#define LENGTH 80
struct LoanInfo
{
/*姓名*/
char name[LENGTH];
/*贷款总额*/
double LoanAmount;
/*贷款年限*/
double LoanYear;
/*月付*/
double MonthlyPayment;
/*总利息*/
double TotalInterest;
/*还款总额*/
double ReimbursementAmount;
/*年利率*/
double apr;
struct LoanInfo * next;
};
void CalcShow(struct LoanInfo * cur, struct LoanInfo * hd,
struct LoanInfo * prv);
int main(void)
{
int temp;
struct LoanInfo * head = NULL;
struct LoanInfo * prev, * current;
current = (struct LoanInfo *)malloc(sizeof(struct LoanInfo));
if (NULL == head)
{
head = current;
}
else
{
prev->next = current;
}/*End of if (NULL == head)*/
puts("请输入姓名");
gets(current->name);
fflush(stdin);
puts("请输入贷款数额(单位:万元)");
scanf("%lf", ¤t->LoanAmount);
fflush(stdin);
puts("请输入贷款年限");
scanf("%lf", ¤t->LoanYear);
fflush(stdin);
printf("姓名:%s,贷款年限:%lf, 贷款数额%lf",
current->name, current->LoanYear, current->LoanAmount);
prev = current;
puts("请确认Y/N");
temp = getchar();
switch(toupper(temp))
{
case 'Y' : CalcShow(current, head, prev);
break;
case 'N' : free(current);
main();
break;
default : puts("输入错误");
free(current);
break;
}
return 0;
}
void CalcShow(struct LoanInfo * cur, struct LoanInfo * hd,
struct LoanInfo * prv)
{
char lcv_temp;
if (cur->LoanYear <= 1)
cur->apr = APR1;
else if (cur->LoanYear <= 3)
cur->apr = APR2;
else if (cur->LoanYear <= 5)
cur->apr = APR3;
else
cur->apr = APR4;
/*End of if (year <= 1)*/
cur->LoanAmount = 10000 * cur->LoanAmount;
cur->ReimbursementAmount = cur->LoanAmount * pow((1 + cur->apr), cur->LoanYear);
cur->MonthlyPayment = cur->ReimbursementAmount / (cur->LoanYear * RTP);
cur->TotalInterest = cur->ReimbursementAmount - cur->LoanAmount;
printf("姓名:%s 贷款年限:%.0lf\n"
"贷款数额:%.2lf 每月还款额:%.2lf\n"
"利息合计:%.2lf 还款总额:%.2lf\n",
cur->name, cur->LoanYear, cur->LoanAmount,
cur->MonthlyPayment, cur->TotalInterest, cur->ReimbursementAmount);
puts("是否继续计算Y/N");
lcv_temp = getchar();
switch(toupper(lcv_temp))
{
case 'Y' : free(cur);
main();
break;
case 'N' : free(cur);
exit(0);
default : puts("输入错误");
free(cur);
main();
break;
}
system("pause");
}
‘玖’ c语言 银行贷款问题(急求)
lz ,这个问题其实是个数学公式,编程求解的话,也就是起到一个计算器的作用(如果不具备公式的话,那就只能通过枚举来一个个尝试了,那就失去针对性了)
刚我算了一下,思路:
1. 年利率为i ,则第一年的利息是 s * i ,第二年是 (s - 12x) * i ,其中x是每月还款额,第三年 (s - 24x) * i ... ... ,第n年的利息是 [ s - 12(n-1)x ] * i ,该等差数列之和为 [s - 6(n-1)x ] * n * i ,这就是n年所产生的总利息了。
2.通过等式 :
(总利息 + 本金)/ 年数 / 12 = 每月还款额
{ [s - 6(n-1)x ] * n * i + s } / 12n = x
解得x = ( nis + s ) / [ 12n + 6(n-1) ni ]
假设房贷 300000 按揭10年 ,利率5% ,每月还3061 ,差不多
‘拾’ c语言这个问题 能帮帮忙嘛 谢谢
//希望我的回答对你的学习有帮助
#include<stdio.h>
#include<math.h>
intmain()
{
doublemoney,capital;
doublerate[4]={0.009,0.01,0.0111,0.012};
intn,m;
scanf("%lf%d",&capital,&n);
m=n/12;
if(n!=12*m){
m++;
}
if(m>3)
money=capital*pow((1+rate[3]),12*m);
else
money=capital*pow((1+rate[m-1]),12*m);
printf("%.2lf ",money);
return0;
}