View Code of Problem 70

#include<stdio.h>
2.int main(){
3.	int x;
4.	scanf("%d",&x);
5.	double y;
6.	if(x<=100000)
7.		y=x*0.1;
8.	else if(x<=200000)
9.		y=100000*0.1+(x-100000)*0.075;
10.	else if(x<=400000)
11.		y=100000*0.1+100000*0.075+(x-200000)*0.05;
12.	else if(x<=600000)
13.		y=100000*0.1+100000*0.075+200000*0.05+(x-400000)*0.03;
14.	else if(x<=1000000)
15.		y=100000*0.1+100000*0.075+200000*0.05+200000*0.03+(x-600000)*0.015;
16.    else{
17.		y=100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015+(x-1000000)*0.01;
18.	}
19.	printf("%0.0f\n",y);
20.}

/*
Main.c:2:1: error: invalid suffix "int" on floating constant
 2.int main(){
 ^
Main.c:2:1: error: expected identifier or '(' before numeric constant
*/

Double click to view unformatted code.


Back to problem 70