Difference between revisions of "Tax calculator in c"

From CodeCodex

(add new category)
 
Line 190: Line 190:
 
}
 
}
 
</pre>
 
</pre>
 +
[[Category:Commerce]]

Latest revision as of 13:00, 9 May 2012

#include<stdio.h>

main()

{

int choice1,income,x,y,a,b;float z;float tax,tax1,tax2,tax3,tax4;

printf("*****************MINI PROJECT*********************************\n");

printf("                TAX CALCULATOR                    \n"); 

printf("**************************************************************\n");

printf("\n[1] MEN\n[2] WOMEN\n[3] SENIOR CITIZEN (age should be above 65)\n");

printf("**************************************************************\n");

printf("ENTER YOUR CATEGORY:-");

scanf("%d",&choice1);

printf("ENTER YOUR ANNUAL INCOME:-\n");

scanf("%d",&income);

switch(choice1)



{  

  case 1:

  if(income>0&&income<=160000)

  printf("YOU NEED TO PAY NO TAX\n ");

  else if(income>160000&&income<=500000)

  {z=0.1*income;}

  else if(income>500000&&income<=800000)

  {z=0.2*income;}

  else if(income>800000)

  {z=0.3*income;}

  printf("YOU NEED TO PAY A TAX OF %f\n",z);

  break;



  case 2:

  if(income>0&&income<=190000)

  printf("YOU NEED TO PAY NO TAX\n");

  else if(income>190000&&income<=500000)

  {z=0.1*income;}

  else if(income>500000&&income<=800000)

  {z=0.2*income;}

  else if(income>800000)

  {z=0.3*income;}

  printf("YOU NEED TO PAY A TAX OF %f\n",z);

  break;

  

  case 3:

  if(income>0&&income<=240000)

  printf("YOU NEED TO PAY NO TAX\n");

  else if(income>240000&&income<=500000)

  {z=0.1*income;}

  else if(income>500000&&income<=800000)

  {z=0.2*income;}

  else if(income>800000)

  {z=0.3*income;}

  printf("YOU NEED TO PAY A TAX OF %f\n",z);

  break;

  default:

  printf("ENTER VALID CATEGORY\n"); 



}

printf("****************TAX REDUCTIONS****************\n");



printf("Please enter the above calculated tax \n");

scanf("%f",&tax);

printf("Do you make any contribution for LIC's or any other insurer ?\n");

printf("If yes enter 1 , else enter 0 :- \n"); 

scanf("%d",&x);

if(x==1)

tax1=tax-10000;

else if(x==0)

tax1=tax;

printf("Do you pay medical insurance for your parents ?\n");

printf("If yes enter 2 , else enter 3 :- \n");

scanf("%d",&y);

if(y==2)

tax2=tax1-15000;

else if(y==3)

tax2=tax1;

printf("Do you suffer from any permanent disability(mental retardation,autism,..)?\n");

printf("If yes enter 4 , else enter 5 :- \n");

scanf("%d",&a);

if(a==4)

tax3=tax2-50000;

else if(a==5)

tax3=tax2;

printf("Do you suffer from severe disability ?\n");

printf("If yes enter 6 ,else enter 7 :- \n");

scanf("%d",&b);

if(b==6)

tax4=tax3-75000;

else if(b==7)

tax4=tax3;



if(tax4<0)

{printf("You need to pay no tax \n");}

else

{printf("ULTIMATELY YOU HAVE TO PAY A TAX OF %f",tax4);}

printf("\n");

printf("MINI PROJECT on 'INCOME TAX CALCULATION'\n done by\nM.KIRUBASANKAR”);

}