Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Task - Building a Simple Calculator | Introduction
Introduction to .NET with C#
course content

Conteúdo do Curso

Introduction to .NET with C#

Task - Building a Simple Calculator

How to solve tasks:

Task:

Create a basic calculator program. It should work like this:

  1. Ask the user for a math operation and store it in a char variable called opr;
  2. Ask the user for the first number, and store it in a float variable called first;
  3. Ask the user for the second number, and store it in a float variable called second;
  4. Apply the operator on the two numbers and display the result.

The entered operation will be of type string, and the user will enter one of the four options: +, -, /, *.

You don't need to deal with cases where the user enters an invalid operation or an invalid number.

The resulting output must be in the following format otherwise, the test cases might fail:

Here first, second and result are float values.

Tudo estava claro?

Seção 1. Capítulo 4
We're sorry to hear that something went wrong. What happened?
some-alt