谁来帮我解决一道题

来源:百度知道 编辑:UC知道 时间:2024/07/01 03:49:04
借我100块钱。,每天利息是10%,,,比如第一天借的100。。第二天就是连本带利110。。第三天是在第二天总价的基础上,也就是110的基础上,再10%。。以此类推,算算,只要我输入他一共借了我多少天,,最后得到总价是多少。 用 C语言编出来 请给出代码

#include <stdio.h>

void main()
{
double dbDebt = 100;
int nDay;

printf("请输入借款的天数:");
scanf("%d", &nDay);

for (int i=1; i<=nDay; i++)
{
dbDebt = dbDebt * 1.1;
}

printf("现在的本金和利息总共是:%f\n", dbDebt);
}

#include <stdio.h>
void main()
{
int a=100;
int b=0.1;
int c;
int d;
printf("Please input the days of you borrow money:\n");
scanf("%d",&c);
for(i=0;i<c;i++)
{
a=a*(1+b);
}
printf("The total is %d.\n",a);

}

#include<stdio.h>
#include<math.h>
void main()
{
int day;
scanf("%d",&day);
printf("100元,借 %d 天,本利和为:%1.2f",day,100*pow(1.1,day));
getchar();
}

s=100;
s=s*1.1;