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

Course Content

Introduction to .NET with C#

Introduction to .NET with C#

1. Introduction
2. Asynchronous Programming and Introduction to Web Services
3. Introduction to Databases with .NET
4. CRUD Operations with MySQL
5. Optimizing Database Operations

bookTask - 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.

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 4
We're sorry to hear that something went wrong. What happened?
some-alt