Showing posts with label hackerrank easy solutions. Show all posts
Showing posts with label hackerrank easy solutions. Show all posts

Friday, January 1, 2021

Rectangle Area | HackerRank | C++ | Solution | Color The Code



Problem : https://www.hackerrank.com/challenges/rectangle-area/problem

Solution : 

class Rectangle{

    public:

    int width;

    int height;

    void display(){

        cout<<width<<" "<<height<<endl;

    }

};

class RectangleArea : public Rectangle{

    public:

    void read_input(){

        cin>>width>>height;

    }

    void display(){

        cout<<(width*height);

    }

};