Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a Go program to implement a simple calculator using interfaces for different operations.

Medium

Problem Statement

Write a Go program to implement a simple calculator using interfaces for different operations.

Sample Input

Two integers (e.g., 10, 5) and operations (+, -, *, /).

Sample Output

15
5
50
2

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
package main import "fmt" type Operation interface { Compute(a, b int) int } func main() { // Implement different operations using the interface }
Log in or sign up to run or submit your code.Log inSign up
Input
Two integers (e.g., 10, 5) and operations (+, -, *, /).
Expected Output
15
5
50
2