View Code of Problem 70

#include<stdio.h>
int main()
{
    int money,s;
    scanf("%d",&money);
    if(money<=100000)
		s=money * 0.1;
	else if(money<=200000)
		s=100000 * 0.1 + (money - 100000)*0.075;
	else if(money <= 400000)
		s=100000 * 0.1 + 100000 * 0.075 + (money - 200000)*0.05;
	else if(money <= 600000)
		s=100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + (money - 400000)*0.03;
	else if(money <= 1000000)
		s=100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.03 + (money - 600000)*0.015;
	else
		s=100000 * 0.1 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.03 + 400000 * 0.015 + (money - 1000000)*0.01;
    printf("%d",s);
    return 0;
}

Double click to view unformatted code.


Back to problem 70