Answer to Question #44375 in Visual Basic for Aden Price

Question #44375
I am working on a personal project on visual basic express 2010 and i was wondering how to add and subtract numbers together in code.
Thanks
1
Expert's answer
2014-07-21T13:39:42-0400
Module Module1
'main function
Sub Main()
'prompt user to enter numbers
Console.Write("Enter first number: ")
Dim firstNumber As Double = Double.Parse(Console.ReadLine())
Console.Write("Enter second number: ")
Dim secondNumber As Double = Double.Parse(Console.ReadLine())
'add two numbers
Dim sum As Double = firstNumber + secondNumber
'show sum
Console.WriteLine("Sum = " + sum.ToString())
'subtract numbers
Dim difference As Double = firstNumber - secondNumber
'show subtract
Console.WriteLine("Difference = " + difference.ToString())
'delay
Console.ReadLine()
End Sub

End Module

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS