當前位置:編程學習大全網 - 編程軟體 - 企業發放的獎金根據利潤提成的編程問題(c語言)

企業發放的獎金根據利潤提成的編程問題(c語言)

main()

{

double x,y=0;

printf("input an number:");

scanf("%lf",&x);

if(x>1e6)

{

y+=(x-1e6)*0.06;x=1e6;

}

if(x>6e5)

{y+=(x-6e5)*0.015;x=6e5;

}

if(x>4e5)

{

y+=(x-4e5)*0.03;x=4e5;

}

if(x>2e5)

{

y+=(x-2e5)*0.05;x=2e5;

}

if(x>1e5)

{

y+=(x-1e5)*0.075;x=1e5;

}

y+=x*0.01;

printf("%f",y);

}

(2)

main()

{

double x,y=0;

long t;

printf("input an number:");

scanf("%lf",&x);

if(x>1e6) t=10;

else t=(long)(x-1)/100000;

switch(t)

{

case 10:y+=(x-1e6)*0.06;x=1e6;

case 9:case 8:case 7:

case 6:y+=(x-6e5)*0.015;x=6e5;

case 5:case 4:y+=(x-4e5)*0.03;x=4e5;

case 3:case 2:y+=(x-2e5)*0.05;x=2e5;

case 1:y+=(x-1e5)*0.075;x=1e5;

defualt: y+=x*0.01;

printf("%f",y);

}

妳運行看看!

錯了我在改!

應該沒錯!

  • 上一篇:杭州西溪谷國際商務中心小區周邊配套怎麽樣?
  • 下一篇:計算機二級的訓練類型對妳做的題有影響嗎?
  • copyright 2024編程學習大全網