Tuesday 19 January 2016

Write A Program That input salary and tells the Tax USing functions accordin to these rules 1) NO TAX FOR FIRST 1000 2) 5% TAX FOR 2ND 1000 3) 4% TAX FOR THIRD 1000 4) 3% TAX FOR REMAINING SALARY in c++

#include<iostream>
using namespace std;
float tax(long int s);
main()
{int salary;
float Tax;
cout<<"Enter Salary :";
cin>>salary;
Tax=tax(salary);
cout<<"Tax on salary is :"<<Tax;
}
float tax(long int s)
{float tax1;
    if (s<=1000)
    {
tax1=0.0;
    cout<<"NO tax :";
}
else if(s>1000&&s<=2000)
     {
s=s-1000.0;
     tax1=5.0/100.0*1000;
}
else if(s>2000&&s<=3000)
     {
  tax1=5.0/100.0*1000.0;
       s=s-2000.0;
        tax1=tax1+(4.0/100.0*1000.0);
}
else
     {
tax1=5.0/100.0*1000.0;
     tax1=tax1+(4.0/100.0*1000);
     s=s-3000;
     tax1=tax1+(3.0/100.0*s);
     }
return tax1;}

Monday 11 January 2016

Write A program that Store information of student in Structure including Roll no, Marks, Avg, Grade in Dev c++

#include<iostream>
using namespace std;
struct student
{int rollno;
 int marks;
 float avg;
 char grade;
 };
main()
{ student s;
   cout<<"Enter the information of Student"<<endl<<endl;
   cout<<"Enter Roll NO of student"<<endl;
   cin>>s.rollno;
   cout<<"Enter the Marks"<<endl;
   cin>>s.marks;
   cout<<"Enter avg"<<endl;
   cin>>s.avg;
   cout<<"Enter The Grade OF Student"<<endl;
   cin>>s.grade;
    cout<<"Roll NO of student  "<<s.rollno<<endl;
   cout<<"Marks are = "<<s.marks<<endl;
   cout<<"Avg is = "<<s.avg<<endl;
   cout<<"Grade is  "<<s.grade;
 
}