#include <iostream>
#include <math.h>
using namespace std;
int main(){
float r_len, r_wid, X_AREA;
cout<<"Enter X_AREA: ";
cin>>X_AREA;
//(r_len + 4) * (r_wid - 1) = X_AREA
//r_len = 4r_wid
//(4r_wid + 4) * (r_wid - 1) = X_AREA
//(4r_wid^2 + 4r_wid - 4r_wid -4) = X_AREA
//4r_wid^2 = X_AREA + 4
//r_wid^2 = (X_AREA + 4)/4
//r_wid = sqrt((X_AREA + 4)/4)
//r_len = 4r_wid
r_wid = sqrt((X_AREA + 4)/ 4);
r_len = 4 * r_wid;
cout<<"length: "<<r_len<<endl;
cout<<"width: "<<r_wid<<endl;
return 0;
}
Comments
Leave a comment