What is the output of the following code assuming circles = 5,and circles radius are [3, 5, 3.5, 12, 0.12]
#include <iostream>
using namespace std;
int main() {
cout << “Enter the number of circles to calculate areafor: “;
cin >> circles;
for(int i=0; i< circles; i++){
float radius, area_circle;
cout << “Enter the radius of circle: “;
cin >> radius;
area_circle = 3.14 * radius * radius;
cout << “Area of circle number (“<<(i+1)<<“)”<< area_circle << endl;
}
return 0;
}
Answer
The given code has lots of errors,i’ll rectify it then outputthe code.
code:-
#include <iostream>
using namespace std;
int main()
{
int circles;//declaring number of circles.
cout << “Enter the number of circles to calculate area for:”;
cin >>
OR
OR