Namespace Variables Functions

#include <iostream>
using namespace std;

namespace MathOps {
    int x = 10;
    int square(int n) {
        return n * n;
    }
}

int main() {
     cout<<"x="<<MathOps::x<<endl;
     cout<<"Square="<<MathOps::square(MathOps::x)<<endl;

    // your code here: call MathOps::square(x) and print result
    return 0;
}

Solving Approach

 

 

 

 

 

Upvote
Downvote
Loading...

Input

Expected Output

x=10 Square=100