Q1) write a simple program in c++ to calculate
1. The circumference of a circle
2. Area of a triangle
3. Area of a square
Q2) write a simple program in c++ to calculate the salary of an employee where by the basic salary will be entered by the user and other allowance as constant.
The following are the other allowance
1. dressing allowance 30% of basic
2. Fuel allowance 20% of basic
3. Maintenance allowance 30% of basic
4. SSNIT allowance 10% of basic
5. Rent allowance 40% of basic
Calculate your gross salary
#include <iostream>
using namespace std;
double circumference(double r) { return 2 * 3.14159 * r; }
double triangle(double a, double h) { return 0.5 * a * h; }
double square(double a, double b) { return a * b; }
int main() {
cout << "area circumference: " << circumference(4.36) << endl;
cout << "area triangle: " << triangle(2.34, 4.06) << endl;
cout << "area square: " << square(12.34, 0.68) << endl;
return 0;
}
Comments
Leave a comment