answersLogoWhite

0

in this example I deal with fictive currency namely: Gold, Silver and Copper coins. 1 Gold is 100 Silver 1 Silver is 100 Copper (thus 1 gold is 10000 copper) ---- #include <windows.h> #include <stdio.h> void denominate(int Copper) { DWORD myCopper = Copper % 100; DWORD mySilver = Copper/100 % 100; DWORD myGold = Copper/10000; printf("You have %d Gold, %d Silver and %d Copper!!",myGold,mySilver,myCopper); } void main() { denominate(12345); } ---- Should Output: You have 1 Gold, 23 Silver and 45 Copper!!

User Avatar

Wiki User

16y ago

What else can I help you with?