Sunday 13 November 2016

Program that accept a salary and return tax


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
}
Share:

2 comments:

  1. # include
    using 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;
    }

    ReplyDelete
  2. 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

Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

About Me

My photo
A group of two, with a little hope of helping beginners to learn how to code :)
Powered by Blogger.

Comments

Facebook

Ad Home

Follow Us

Random Posts

Sponsor

Recent Posts

Header Ads

Popular Posts

Copyright © Functions in C++ | Powered by Blogger

Design by ThemePacific | Blogger Theme by NewBloggerThemes.com | Distributed By Blogger Templates20