Assignment - I
Assignment - I
Assignment - I
Suggested Algorithm:
1. Take input of base and height of the triangle (use appropriate data types) Triangle area
2. Calculate the area as per the formula calculation
3. Display the area of the triangle
Program to be implemented
Write a C++ program that takes the base and height of the triangle as input and display its area. (Use
appropriate data types)
Example:
What is the area of a triangle where every side is 5 units long?
(5+5+5)
Step1: 𝑠 = 2
= 7.5
Step2: 𝑎𝑟𝑒𝑎 = √7.5 × 2.5 × 2.5 × 2.5 = 10.825 …
Suggested Algorithm:
1. Take input of the three sides of the triangle (use appropriate data types)
2. Calculate half of the triangle’s perimeter ‘s’ (as in step 1)
3. Calculate the area of the triangle (as in step 2)
4. Display the area of the triangle
Program to be implemented
Write a C++ program that takes the three sides of the triangle as input and display its area using Heron’s
formula. (Use appropriate data types)
Page 1 of 2
Program to calculate the salary of the employee
Given the following constrains and we have to calculate net salary of an employee.
1. Allowances:
i. Education Allowance (EA): 12% of Basic salary
ii. House Rent Allowance (HRA): 25% of Basic salary
iii. Medical Allowance (MA): 15% of Basic salary
iv. Travelling Allowance (TA): 10% of Basic salary
2. Tax cuts:
i. Provident Fund (PF) :10% of Basic salary, and
ii. Income Tax (IT): 15% of Basic salary
Program to be implemented
Write a program using C++ that takes Basic Salary of an employee as input and display the net salary as
well as all the allowances and tax cuts. (Use appropriate data types)
Program to be implemented
Write a C++ program that takes two integer values, as input, in two variables and perform the swapping
of values in these variables.
Program to be implemented
Write a C++ program that takes radius (floating point) of a circle as input and display the circumference
and area of the circle.
Page 2 of 2