Pennies For Your Change

wally
1,651 views
undefined

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content
Imports System
Public Module modmain
' The number of pennies to start with
Dim pennies As Integer
Dim change As Integer
Sub Main()
' Change the number of pennies below to whatever
pennies = 149
Console.WriteLine("If I gave you " & pennies & " pennies you would give me ...")
change = pennies
Console.WriteLine(Int(change / 100) & " dollars")
change = pennies Mod 100
Console.WriteLine(Int(change / 25) & " quarters")
change = pennies Mod 25
Console.WriteLine(Int(change / 10) & " dimes")
change = pennies Mod 10
Console.WriteLine(Int(change / 5) & " nickels")
change = pennies Mod 5
Console.WriteLine("And " & change & " pennies")
End Sub
End Module
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content