Paula and Danny want to plant evergreen trees along the back side of their yard. They do not want to have an excessive number of trees.
Write a program that prompts the user to input the following:
The program outputs:
Format your output with setprecision(2) to ensure the proper number of decimals for testing!
Here is program:
int main()
{
int lenghtyard;
int radius;
int required;
float pi = 3.14159;
cout << "Enter the length of the yard: " << endl;
cin >> lenghtyard;
cout << "Enter radius of a fully grown tree: " << endl;
cin >> radius;
cout << "Enter required space between fully grown trees: " << endl;
cin >> required;
cout << "The number of trees that can be planted in the yard: " << (radius + required) / lenghtyard << endl;
cout << "The total space that will be occupied by the fully grown trees: " << radius / lenghtyard << endl;
}
Comments
Leave a comment