-
What is the output of this program?
#include <iostream>
using namespace std;
class Rectangle
{
int p, q;
public:
void value (int, int);
int area ()
{
return (p * q);
}
};
void Rectangle::value (int n, int m)
{
p = n;
q = m;
}
int main ()
{
Rectangle Rectangle;
Rectangle.value (6, 5);
cout << "Area of Rectangle : " << Rectangle.area();
return 0;
}
-
- Area of Rectangle : 30
- Area of Rectangle : 3
- Area of Rectangle : 4
- Compilation Error
- None of these
Correct Option: A
In this program, we are calculating the area of rectangle based on given values.