Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- int main(){
- // Variables
- float length;
- float width;
- float X_AREA;
- // Inputs
- cout << "Area of the Rectangle: ";
- cin >> X_AREA;
- // X_AREA = ((4 * width) + 4) * (width - 1)
- // A = 4w^2 - 4w + 4w - 4
- // A = 4w^2 - 4
- // sqrt((A + 4)/4) = sqrt(w^2)
- // w = sqrt((A + 4/4)
- // Find the width and length
- //X_AREA = (4 * pow(width,2) - 4);
- width = sqrt((X_AREA + 4)/4);
- length = 4 * width;
- cout << "Length of the Rectangle: " << length << endl;
- cout << "Width of the Rectangle: " << width;
- }
Add Comment
Please, Sign In to add comment