#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
int main()
{
double s, t, r, d;
printf("Input salary:");
scanf_s("%lf", &s);
if (s > 3500)
{
if (s > 5000)
{
if (s > 12500)
{
if (s > 38500)
{
r = 0.35; d = 2755;
}
else
{
r = 0.25; d = 1005;
}
}
else
{
r = 0.2; d = 555;
}
}
else
{
r = 0.03; d = 0;
}
}
else
{
r = 0; d = 0;
}
t = r * (s - 3500) - d;
printf("t = %.2f\n", t);
return 0;
}
可以运行,代码放在main.c中,先
gcc main.c
编译,a.exe
运行,输入123,输出t = -0.00。当然代码逻辑有问题另说了。