Contenido del Curso
Introduction to .NET with C#
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:
- Ask the user for a math operation and store it in a
char
variable calledopr
; - Ask the user for the first number, and store it in a
float
variable calledfirst
; - Ask the user for the second number, and store it in a
float
variable calledsecond
; - 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.
¡Gracias por tus comentarios!