本额等息房贷计算器、计算表达式、数值转换
本额等息房贷计算器
/*
功能:本额等息房贷计算器
日期:2013-03-27
*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(void){
double monthPay,monthRate,payTot,ratTot,monthes,years,loan;
const double yearsRate=0.0556;
printf("请输入贷款年限:");
scanf("%lf",&years);
printf("请输入贷款金额:");
scanf("%lf",&loan);
monthRate = yearsRate / 12.0 ;
monthes = years * 12.0 ;
monthPay = ( loan * monthRate )+ ( (loan * monthRate ) /((pow(1+monthRate,monthes))-1.0) );
payTot = monthPay * monthes ;
ratTot = payTot - loan ;
printf("你的还款总额是:%.3lfn",payTot);
printf("利息总额是:%.3lfn",ratTot);
printf("你的月供是:%.3lfn",monthPay);
system("pause");
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
计算表达式
/*
功能:计算表达式
作者:windCoder
日期:2013-03-27
*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(void)
{
double x,y,one,two,three,four;
const double PI=3.14;
printf("请输入索要计算的x和y值:");
scanf("%lf %lf",&x,&y);
one = sqrt( x * x + y * y) / (2 * x);
two = 1.0 / ( 1.0 + ( 1.0 / x ) );
three = ( sin(x) + log( fabs(y) ) )/ (2.0 * cos(PI/3.0) );
four = ( cos(PI/6.0) + (2.0 * exp(x) ) )/ (2.0 * y + pow(y,x) ) ;
printf("第一个表达式的值:%.2lfn",one);
printf("第二个表达式的值:%.2lfn",two);
printf("第三个表达式的值:%lfn",three);
printf("第四个表达式的值:%lfn",four);
system("pause");
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
数值转换
/*
功能:数值转换
作者:windCoder
日期:203-03-27
*/
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
double a,b;
printf("输入两个数值(以逗号隔开):");
scanf("%lf,%lf",&a,&b);
printf("交换前:a=%lg,b=%lgn",a,b);
b+=a;
a=b-a;
b-=a;
printf("交换后:a=%lg,b=%lgn",a,b);
system("pause");
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
预览
除特别注明外,本站所有文章均为 Windcoder网 原创,转载请注明出处来自: this-amount-of-income-mortgage-calculator-computation-expressions-numeric-conversion
Loading comments...

预览
暂无数据