View Code of Problem 70

#include <stdio.h>

int main()
{
	int profit,ward;
	scanf("%d",&profit);
	if(profit <= 100000)
		ward = profit * 0.1;
	else if(profit > 100000 && profit <= 200000)
		ward = 10000 + (profit - 100000) * 0.075;
	else if(profit > 200000 && profit <= 400000)
	    ward = 10000 + 100000 * 0.075 + (profit - 200000) * 0.05;
	else if(profit > 400000 && profit <= 600000)  
		ward = 10000 + 100000 * 0.075 + 200000 * 0.05 + (profit - 400000) * 0.03;
	else if(profit > 600000 && profit <= 1000000)
		ward = 10000 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.03 + (profit - 600000) * 0.015;
	else
		ward = 10000 + 100000 * 0.075 + 200000 * 0.05 + 200000 * 0.03 + 400000 * 0.015 + (profit - 1000000) * 0.001;
	printf("%d",ward);
    return 0;
}

Double click to view unformatted code.


Back to problem 70