Write a function that accepts a salary and returns the tax according to the following rules: No tax for first Rs.1000 , 5% tax for second Rs.1000 , 4% tax for third Rs.1000, 3% for remained untaxed salary
#include<iostream.h>
#include<conio.h>
int TAX(int sal);
void main()
{
clrscr();
int salary , tax;
cout<<"Enter salary: ";
cin>>salary;
tax = TAX(salary);
if(tax == 0)
cout<<"No Tax";
else
cout<<"The Tax is : "<<tax;
getch();
}
int TAX(int sal)
{
int tax;
if(sal > 3000)
return (5*1000)/100
}
# include
ReplyDeleteusing namespace std;
void taxcalc(int n)
{
float tax, remaining;
if(n<=1000)
{
tax=0;
cout<<" If salary is Rs. "<3000)
{
remaining=n-3000;
tax=0.03*remaining;
remaining=3000-2000;
tax=tax+(0.04*remaining);
remaining=2000-1000;
tax=tax+(0.05*remaining);
cout<<" If salary is Rs. "<2000)
{
remaining=n-2000;
tax=0.04*remaining;
remaining=2000-1000;
tax=tax+(0.05*remaining);
cout<<" If salary is Rs. "<1000)
{
remaining=n-1000;
tax=0.05*remaining;
cout<<" If salary is Rs. "<> salary;
taxcalc(salary);
return 0;
}
write a c++ program using function that accepts a salary and returns the tax according to following rule: No tax for first Rs.1000 5% for second Rs. 1000 4% for third Rs.1000 3 % for remain untaxed salary. For example, if the salary is Rs. 4000, then the tax is Rs.120
ReplyDelete