Friday, October 26, 2018

Uri 1051 solution in C | Taxes

/*Before seeing the code solution make sure that you have tried enough. Don’t copy- paste the whole code. Find out the logic. If you face any trouble, just inform me in comment.*/

#include<stdio.h>
main()
{
    double n,s,s1;
    scanf("%lf",&n);
    if(n>0&&n<=2000)
    {
        printf("Isento\n");
    }
    else if(n>2000&&n<=3000)
    {
        s1=n-2000;
        s=s1*.08;
        printf("R$ %.2lf\n",s);
    }
    else if(n>3000&&n<=4500)
    {
        s1=n-3000;
        s=80+(s1*.18);
        printf("R$ %.2lf\n",s);
    }
    else if(n>4500)
    {
        s1=n-4500;
        s=350+(s1*.28);
        printf("R$ %.2lf\n",s);
    }
    return 0;
}


 //Happy_Coding

No comments:

Post a Comment