下面的代码编译不过,可以告诉我是什么原因吗?
#include<inttypes.h>#include<math.h>#include<stdio.h>intmain(void){uint32_tprofit=0;u...
#include<inttypes.h>
#include<math.h>
#include<stdio.h>
int main(void)
{
uint32_t profit = 0;
uint32_t reward = 0;
uint32_t temp = 0;
printf("please input the profit:\n");
scanf("%d",&profit);
if(profit < 10)
{
reward = profit * 10%;
}
else
{
temp = 10 * 10%;
profit = profit - 10;
if(profit < 10)
{
reward = temp + profit * 7.5%;
}
else
{
temp += 10 * 7.5%;
profit -= 10;
if(profit < 20)
{
reward = temp + profit * 5%;
}
else
{
temp += 20 * 5%;
profit -= 20;
if(profit < 20)
{
reward = temp + profit * 3%;
}
else
{
temp += 20 * 3%;
profit -= 20;
if(profit < 40)
{
reward = temp + profit * 1.5%;
}
else
{
temp += 40 * 1.5%;
profit -= 40;
reward = temp + profit * 1%;
}
}
}
}
}
printf("the total reward is : %d\n",reward);
return 0;
} 展开
#include<math.h>
#include<stdio.h>
int main(void)
{
uint32_t profit = 0;
uint32_t reward = 0;
uint32_t temp = 0;
printf("please input the profit:\n");
scanf("%d",&profit);
if(profit < 10)
{
reward = profit * 10%;
}
else
{
temp = 10 * 10%;
profit = profit - 10;
if(profit < 10)
{
reward = temp + profit * 7.5%;
}
else
{
temp += 10 * 7.5%;
profit -= 10;
if(profit < 20)
{
reward = temp + profit * 5%;
}
else
{
temp += 20 * 5%;
profit -= 20;
if(profit < 20)
{
reward = temp + profit * 3%;
}
else
{
temp += 20 * 3%;
profit -= 20;
if(profit < 40)
{
reward = temp + profit * 1.5%;
}
else
{
temp += 40 * 1.5%;
profit -= 40;
reward = temp + profit * 1%;
}
}
}
}
}
printf("the total reward is : %d\n",reward);
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询