There is a calculator code that must add / subtract / multiply / divide two numbers.
Module Module1 Sub Main() Console.WriteLine("Enter the first digit... ") Dim x As Integer = Console.ReadLine() Console.WriteLine("Enter the second digit... ") Dim y As Integer = Console.ReadLine() Console.WriteLine("Choose operation(+, -, /, *)") If Console.ReadLine() = "*" Then Console.WriteLine(x * y) Console.ReadLine() ElseIf Console.ReadLine() = "/" Then Console.WriteLine(x / y) Console.ReadLine() ElseIf Console.ReadLine() = "+" Then Console.WriteLine(x + y) Console.ReadLine() ElseIf Console.ReadLine() = "-" Then Console.WriteLine(x - y) Console.ReadLine() End If End Sub End Module But it happens:
After entering the sign of the operation with numbers and three clicks of Enter, the command line disappears. Perhaps I did not correctly assign values to variables or did not output the result in the same way.
*must be entered 1 time;/- 2 times,+- 3 times,-- 4 times - Kir_Antipovif-elsechain in each condition you initiate a new input from the user. Read the line once, sticking the value into a variable, and then check the value of the variable) - Kir_AntipovReadLinebefore theifblock, write the result into a variable, and then check the value of the variable insideif. - insolor