171k views
1 vote
Given a double variable named areaofsquare write the necessary code to read in a value , the area of some square, into areaofsquare and print out the length of the side of that square.

User Vao Tsun
by
6.7k points

1 Answer

5 votes
I guess you need solution on C++. Here is the code:

int main () { double areaofsquare; double length cin >> areaofsquare;
length = sqrt(areaOfSquare);

std::cout << length << std::endl; if(areaofsquare >= 0) { sqrt(areaofsquare); cout << areaofsquare << endl; } else { cout << "INVALID" << endl; }
}
User Shawn Andrews
by
5.4k points