|
-
Mar 3rd, 2006, 08:21 PM
#1
Thread Starter
New Member
[RESOLVED] Simple Program
New to the forums, and wanted to ask the .NET pros out there a rather simple question, something I'm stuck on. For my college class, we have to make a program that takes a number of pennies you enter, and puts out the number of dollars, quarters, dimes, nickels, and remaining pennies in that total number of pennies.
In example.....i type in 180 to the main textbox, and below, it will show 1 dollar, 3 quarters, and 1 nickel.
Now the problem, I set all my variables as Integer, and started doing the equations. The dollars comes out correctly, and the quarters come out correctly, but my dimes, nickles, and remaining pennies will not even show up. Am i missing something?
This is the code I have entered so far
-----------
Dim totalpennies As Integer
Dim dollars As Integer
Dim quarters As Integer
Dim dimes As Integer
Dim nickles As Integer
Dim pennies As Integer
totalpennies = CSng(txtPennies.Text)
dollars = totalpennies \ 100
totalpennies = totalpennies Mod 100
quarters = totalpennies \ 25
totalpennies = quarters Mod 25
dimes = totalpennies \ 10
totalpennies = dimes Mod 10
nickles = totalpennies \ 5
totalpennies = nickles Mod 5
-------------------------
So everything works except for "dimes = totalpennies \ 10" and down
I'm probably doing something stupid wrong, help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|