Answer to Question #200997 in C++ for Master j

Question #200997

Write a c++ program that calculates the slope of ramp using the equation a2 + b2 = c2 where a is the height of the ramp b is the width of the ramp and c is the slope of the ramp. The program should accept the height and width and calculate and print the slope of the ramp


1
Expert's answer
2021-05-31T05:39:37-0400
#include <iostream>
#include <cmath>
 
using namespace std;
 
int main()
{
	double a, b, c;
	cout << "Enter width of the ramp: ";
	cin >> a;
	cout << "Enter height of the ramp: ";
	cin >> b;
	c = sqrt(a * a + b * b);
	cout << "The slope of the ramp is: " << c << endl;
	system("pause");
	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