Back
Close

Pennies For Your Change

wally
1,771 views
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
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants