Answer to Question #256736 in C++ for Prisy

Question #256736


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


1
Expert's answer
2021-10-26T07:09:06-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS