Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
Enter to Rename, Shift+Enter to Preview
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content