Rewrite the following C++ code after removing any/all Syntactical Error(s) with each correction underlined.
Note: Assume all required header files are already being included in the program.
#define float PI 3.14
void main( )
{
float R=4.5,H=1.5;
A=2*PI*R*H + 2*PIpow(R,2);
cout<<‘Area=’<
}
Answers
Answered by
1
#include <cmath>
#include <iostream>
#define PI 3.14
void main( )
{
float R=4.5,H=1.5 ,A=2*PI*R*H + 2 *PI *pow(R,2);
std::cout << "Area=" << A;
}
Answered by
7
Program After removing Syntactical Errors:
#include<iostream>
#include<math.h>
using namespace std;
#define PI 3.14
#include<math.h>
int main()
{
float R = 4.5, H = 1.5,A;
A = 2 * PI * R * H + 2 * PI * pow(R,2);
cout << "Area = " << A;
}
Output:
Area = 169.56.
Hope it helps!
Similar questions