Saturday, 28 May 2016

Q: Write a program that inputs the names and monthly salaries of ten employees. The program checks annual salary of each person. if annual salary is greater than or equal to Rs. 2,50000/- then it prints name, salary and a message " Tax to be paid" else it prints name, salary and a message " No Tax".

Program:

#include<iostream.h>
#include<conio.h>
void main()
{
  int sal[10],i;
  char name[10][30];
  clrscr();
  for(i=0 ; i<10; i++)
 {
   cout<<"Enter the name of the employee: ";
   cin>>name[i];
   cout<<"Enter the salary of the employee: ";
   cin>>sal[i];
   if(sal[i]*12>=250000)
  {
    cout<<" Name of the employee: "<<name[i]<<endl;
    cout<<" Salary of the employee: "<<sal[i]<<endl;
    cout<<" Tax to be paid! "<<endl;
  }
  else
 {
   cout<<" Name of the employee: "<<name[i]<<endl;
   cout<<" Salary of the employee: "<<sal[i]<<endl;
   cout<<" No Tax! "<<endl;
  }
  }
   getche();
}

No comments:

Post a Comment