Tax Slabs - SLAB – FEBRUARY COOKOFF 2020 DIV2(EASY)

Tax Slabs Problem Code: SLAB – February cookoff 2020 div2(EASY)

                           


Given,

Total income (in rupees)

Tax rate

up to Rs. 250,000

0%

from Rs. 250,001 to Rs. 500,000

5%

from Rs. 500,001 to Rs. 750,000

10%

from Rs. 750,001 to Rs. 1,000,000

15%

from Rs. 1,000,001 to Rs. 1,250,000

20%

from Rs. 1,250,001 to Rs. 1,500,000

25%

above Rs. 1,500,000

30%

 

We have to find the income of the Chef after removal of tax rate.

Look at the code for more clarification.

 

Here, is the code in c :

#include <stdio.h>

int main(void) {

int t;

long long int n,x,bill;

scanf("%d",&t);

while(t--)

{ 

    bill=0;

    scanf("%lld",&n);

    x=n;

    if(n<=250000)

    printf("%lld\n",n);

  

    else

    {

        if(x>=250001)

        {

            if(x<=500000)

            bill+=5*(x-250000)/100;

            else

            bill+=12500;

        }

        if(x>=500001)

        {

            if(x<=750000)

            bill+=10*(x-500000)/100;

            else

            bill+=25000;

        }

        if(x>= 750001 )

        {

            if(x<=1000000)

            bill=bill+15*(x-750000)/100;

            else

            bill=bill+37500;

        }

        if(x>=1000001)

        {

            if(x<=1250000 )

            bill+=20*(x-1000000)/100;

            else

            bill+=50000;

        }

        if(x>=1250001)

        {

            if((x<=1500000))

            bill+=25*(x-1250000)/100;

            else

            bill+=62500;

        }

       if(x>1500000)

        bill+=30*(x-1500000)/100;

       

       

     printf("%lld\n",x-bill);  

    }

   

}

               return 0;

}


Comments

Popular Posts