Build a MathUtility Class

Hard Static Members & Friend Functions PRO
🔒 Login to Unlock

Problem Statement

Combine the concepts! Build a `MathUtility` class containing a public `static const int pi = 3` (simplified PI) and a public static method `int multiply(int a, int b)`. In `main()`, read two integers, call the static method, and print ‘Product: [P]’ followed by ‘PI: [pi]’ on a new line.

Input Format

Two space-separated integers.

Output Format

Print the product and the static constant PI.

Constraints

None

Sample Input

4 5

Sample Output

Product: 20
PI: 3

Explanation

Utility classes often group pure logic and global constants using static members, meaning they never need to be instantiated to be used.

Starter Code

#include <iostream>

class MathUtility {
    // Define static const pi and static multiply method
};

// Provide out-of-class definition for pi if needed (based on C++ standards)

int main() {
    // Read input, call static method, print output
    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