[vb/en] fix type inconsistencies for calculator subs

This commit is contained in:
ioab 2015-11-04 00:24:43 +03:00
parent 05dac0dd35
commit d92db6ea39

View File

@ -126,10 +126,10 @@ Module Module1
'Of course we would like to be able to add up decimals.
'Therefore we could change the above from Integer to Double.
'Enter a whole number, 1.2, 2.4, 50.1, 104.9 etc
'Enter a floating-point number, 1.2, 2.4, 50.1, 104.9 etc
Console.Write("First number: ")
Dim a As Double = Console.ReadLine
Console.Write("Second number: ") 'Enter second whole number.
Console.Write("Second number: ") 'Enter second floating-point number.
Dim b As Double = Console.ReadLine
Dim c As Double = a + b
Console.WriteLine(c)
@ -145,12 +145,12 @@ Module Module1
'Copy and paste the above again.
Console.Write("First number: ")
Dim a As Double = Console.ReadLine
Console.Write("Second number: ") 'Enter second whole number.
Dim b As Integer = Console.ReadLine
Dim c As Integer = a + b
Dim d As Integer = a * b
Dim e As Integer = a - b
Dim f As Integer = a / b
Console.Write("Second number: ") 'Enter second floating-point number.
Dim b As Double = Console.ReadLine
Dim c As Double = a + b
Dim d As Double = a * b
Dim e As Double = a - b
Dim f As Double = a / b
'By adding the below lines we are able to calculate the subtract,
'multiply as well as divide the a and b values
@ -179,11 +179,11 @@ Module Module1
Console.Write("First number: ")
Dim a As Double = Console.ReadLine
Console.Write("Second number: ")
Dim b As Integer = Console.ReadLine
Dim c As Integer = a + b
Dim d As Integer = a * b
Dim e As Integer = a - b
Dim f As Integer = a / b
Dim b As Double = Console.ReadLine
Dim c As Double = a + b
Dim d As Double = a * b
Dim e As Double = a - b
Dim f As Double = a / b
Console.Write(a.ToString() + " + " + b.ToString())
Console.WriteLine(" = " + c.ToString.PadLeft(3))