Extending Namespaces across Multiple Blocks

Medium Namespaces
Solve in Playground →

Problem Statement

Write a C++ program demonstrating that namespaces can be reopened and extended across different blocks or files.

Input Format

Two space-separated integers A and B.

Output Format

Print sum and product computed across separate namespace extension blocks.

Constraints

-100 <= A, B <= 100

Sample Input

5 4

Sample Output

Sum: 9
Product: 20

Explanation

Namespaces are open sets, allowing functions and variables to be added across multiple declaration blocks.

Starter Code

#include <iostream>

namespace SystemUtils {
    int add(int a, int b) {
        return a + b;
    }
}

namespace SystemUtils {
    int multiply(int a, int b) {
        return a * b;
    }
}

int main() {
    int a, b;
    if (std::cin >> a >> b) {
        // Print sum and product using extended SystemUtils namespace
    }
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used