69,371
社区成员
发帖
与我相关
我的任务
分享
#include "stdio.h"
void main()
{
float base=100;
int year=1;
base*=1.08;
while((base-=10)>=0)
{
base*=1.08;
year++;
}
printf("%d年将会清空他的账户!",year);
}
#include <stdio.h>
int com(double toal, double interest)
{
int i = 0;
double temp = toal;
while(temp > 0)
{
temp -= 10;
temp = temp + temp * 8 /100;
i++;
}
return i;
}
void main()
{
printf("%d", com(100, 8));
}
#include<stdio.h>
float total = 100;
int n = 0;
while (total > 0) {
total = total * 1.08 - 10;
n++;
}
printf("%d\n", n);
float sum(int n);
int i=1;//再就是这儿的i初始值要为1,否则你第一次调用sum这个函数会出错
while(sum(i)>=0)
if(n==1)//应该是双等号。。。
return (float)100;
else if(n>=2)
return (sum(n-1)*1.08-10);