Professional Documents
Culture Documents
Code
Output
2. Write a C++ program to input basic salary of an employee and calculate its Gross salary
according to following:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95%
Code
Output
Code
Output
Output
5.Write a method with a while loop that computes the sum of first n positive integers: sum =
1 + 2 + 3 + … + n.
Code
Output
6.Write a C++ program to calculate the approximate values of sin(x) and cos(x) using the Taylor series
expansion. You should allow the user to input the value of 'x' and the number of terms in the series to
use. The program should then display the calculated values of sin(x) and cos(x).
Code
Output