C语言求银行本息和利润和

C语言求银行本息和利润和,第1张

#include<stdio.h>

void main(){

double num,rate=0.00417,sum=0

int i

scanf("%lf",&num)

while(num<=0){

printf("输入的存款金额必须大于0!\n")

scanf("%lf",&num)

}

for(i=1i<=5i++){

sum=((100+sum)*(1+rate))

}

printf("%.3f\n",sum)

}

#include <stdio.h>

#include <stdlib.h>

void main(void)

{

double money,bouns

printf("input the money, input a negitive number to leave:")

do{

scanf("%lf",&money)

if(money<=100000) bouns=money*0.1

else if(money<=200000) bouns=(money-100000)*0.075+100000*0.1

else if(money<=400000) bouns=(money-200000)*0.05+100000*0.075+100000*0.1

else if(money<=600000) bouns=(money-400000)*0.03+200000*0.05+100000*0.075+100000*0.1

else if(money<=1000000) bouns=(money-600000)*0.015+200000*0.03+200000*0.05+100000*0.075+100000*0.1

else if(money>100000) bouns=(money-1000000)*0.01+400000*0.015+200000*0.03+200000*0.05+100000*0.075+100000*0.1

printf("bouns is %.2lf\n",bouns)

}

while(money>=0)

}

#include <stdio.h>

#include <stdlib.h>

void main(void)

{

double money,bouns

int temp

printf("input the money, input a negitive number to leave:")

do{

scanf("%lf",&money)

temp=money/100000

switch(temp)

{

case 0: bouns=money*0.1break

case 1: bouns=(money-100000)*0.075+100000*0.1break

case 2:

case 3: bouns=(money-200000)*0.05+100000*0.075+100000*0.1break

case 4:

case 5: bouns=(money-400000)*0.03+200000*0.05+100000*0.075+100000*0.1break

case 6:

case 7:

case 8:

case 9: bouns=(money-600000)*0.015+200000*0.03+200000*0.05+100000*0.075+100000*0.1break

default: bouns=(money-1000000)*0.01+400000*0.015+200000*0.03+200000*0.05+100000*0.075+100000*0.1

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/11999393.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-20
下一篇 2023-05-20

发表评论

登录后才能评论

评论列表(0条)

保存