Saturday, September 13, 2008

MPG code and Squaring Number Code

Module Module1

Sub Main()

Console.WriteLine("Please enter the miles driven (in miles)")
Dim milesDriven As Decimal = Console.ReadLine()
Console.WriteLine("Please enter the gas used (in gallons)")
Dim gasUsed As Decimal = Console.ReadLine()
'declaring variable gasUsed as a decimal
'and reading line from the console!
Dim mpg As Decimal = milesDriven / gasUsed
Console.WriteLine(mpg & " is the mpg used")

'Square your number program!
Console.WriteLine("Please enter a number to be squared ")
Dim numberToBeSquared As Decimal = Console.ReadLine
Dim numberSquared As Decimal = numberToBeSquared ^ 2
Console.WriteLine(numberToBeSquared & " was your number")
Console.WriteLine(numberSquared & " is the number squared")
Console.WriteLine("Enter any number to quit")
Dim endProgram As String = Console.ReadLine
'* multiplication
'/ division

End Sub

End Module

No comments: