#include<stdio.h> int main(){ int a; scanf("%d",&a); if(a<=100000)printf("%d",a*0.1); else if(a>100000&&a<=200000)printf("%d",100000*0.1+(a-100000)*0.075); else if(a>200000&&a<=400000)printf("%d",100000*0.1+(100000)*0.075+(a-200000)*0.05+); else if(a>400000&&a<=600000)printf("%d",100000*0.1+(100000)*0.075+(100000)*0.05); else if(a>600000&&a<=1000000)printf("%d",a*0.1); else if(a>1000000)printf("%d",a*0.1); return 0 } /* Main.c: In function 'main': Main.c:6:2: warning: format '%d' expects argument of type 'int', but argument 2 has type 'double' [-Wformat=] if(a<=100000)printf("%d",a*0.1); ^ Main.c:7:5: warning: format '%d' expects argument of type 'int', but argument 2 has type 'double' [-Wformat=] else if(a>100000&&a<=200000)printf("%d",100000*0.1+(a-100000)*0.075); ^ Main.c:8:84: error: expected expression before ')' token else if(a>200000&&a<=400000)printf("%d",100000*0.1+(100000)*0.075+(a-200000)*0.05+); ^ Main.c:9:2: warning: format '%d' expects argument of type 'int', but argument 2 has type 'double' [-Wformat=] else if(a>400000&&a<=600000)printf("%d",100000*0.1+(100000)*0.075+(100000)*0.05); ^ Main.c:10:2: warning: format '%d' expects argument of type 'int', but argument 2 has type 'double' [-Wformat=] else if(a>600000&&a<=1000000)printf("%d",a*0.1); ^ Main.c:11:2: warning: format '%d' expects argument of type 'int', but argument 2 has type 'double' [-Wformat=] else if(a>1000000)printf("%d",a*0.1); ^ Main.c:13:1: error: expected ';' before '}' token } ^ */ |
Double click to view unformatted code.