TOPIC

wrong answer 10% C

THIAGO DE AZEVEDO ZANINI asked 4 months ago

include include include include

int main(){ double A, X ;

scanf("%lf",  &A);
if (A<=2000) {
    printf("Isento\n");
}
if (A>2000  &&  A<=3000) {
    X=((A-2000)*0.08);}
else if(A>3000 && A<=4500) {
    X=(((A-3000)*0.18)+80);}
else if (A>4500){
    X=(((A-4500)*0.28)+80+270);
}
printf("R$ %.2lf\n",  X);

return 0; }

This topic was solved and cannot recieve new replies.

  • josean replied 4 months ago

    Quando for isento não precisa exibir nenhum valor. Um else resolve.

    CÓDIGO:

    int main(){
        double A;
        float X;
        scanf("%lf",  &A);
        if (A<=2000) {
            printf("Isento\n");
        }else{
            if (A>2000  &&  A<=3000) {
                X=((A-2000)*0.08);}
            else if(A>3000 && A<=4500) {
                X=(((A-3000)*0.18)+80);}
            else if (A>4500){
                X=(((A-4500)*0.28)+80+270);
            }
            printf("R$ %.2lf\n",  X);
        }    
        return 0;
    }