Search⌘ K

Challenge 2: Make a Calculator

Explore how to create a calculator in Rust by handling multiple operators with match statements. Learn to perform arithmetic operations and manage invalid inputs or errors like division by zero, building your skills in Rust control flow.

Problem Statement

Write a code which will take:

  • Two variables named a and b

  • a character type variable called operator which will take operators (+,-,/,*,%) will be passed as input to our match statement

  • Use match ...

svg viewer