Previous Next
0 / 5
Module DEMO-32-54DEMO-C-32

Simple Calculator Question without scanf

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Ahmed and his friend, Omar, were studying for their math exam at a coffee shop in Amman, Jordan. They both had calculators with them, but they realized that they couldn't perform simple calculations on each other's devices due to different operating systems. Ahmed asked Omar to help him write a small program that would take two numbers as input and output the sum, difference, product, and quotient of those numbers. This way, they could quickly calculate any mathematical expression without needing an actual calculator.

Constraints

Input integers will not exceed three digits in length.

Input Format

no input
variables must be predefined a=40 b=20

Output Format

Prints the sum, difference, product, and quotient of a and b.

Sample Testcases

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

Sample #1
Public sample
sum of a and b = 60
difference of a and b = 20
product of a and b = 800
quotient of a and b = 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