Namespace with Variables and Functions

#include <iostream>
using namespace std;

namespace MathOps {

    int x = 10;

    int square(int n) {

        return n * n;

    }

}

int main() {


    // your code here: print MathOps::x

    cout << "x=" << MathOps::x << "\n";
    // your code here: call MathOps::square(x) and print result

    cout << "Square=" << MathOps::square(MathOps::x);
    return 0;
}
Upvote
Downvote
Loading...

Input

Expected Output

x=10 Square=100