Previous Next
0 / 13
Module DEMO-32-56DEMO-C-32

Simple Calculator Challenge

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

In a small village in Amman, Jordan, there lives a young child named Omar who loves math. He wants to create a simple calculator to help his friends with basic arithmetic operations. However, he knows that not everyone is familiar with the concept of variables and conditions. So, he needs your help to design a program that can take in two numbers, an operator (+, -, *, /), and display the result. Omar's friend has asked him to make sure the calculator handles division by zero correctly.

Constraints


Input Format

int char int

Output Format

int

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
1 + 2
3
Sample #2
Public sample
4 * 5
20
Sample #3
Public sample
10 / 0
Division by zero error!
Sample #4
Public sample
5 - 10
-5
Sample #5
Public sample
6 / 3
2

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings