Miscellaneous > Programming & Networking

Programming Challenge N

<< < (2/3) > >>

TheQuirk:
This approach works. However, I challenge you to come up with something more compact!

H_TeXMeX_H:
I don't think it'll get any more compact than that :( ... anyone else wanna try ?

worker201:
I'm a pretty shitty programmer, I can barely slap together a helloworld anymore without a myriad of syntax errors.  But hey, I got this one to work!  For some reason, I got it in my head that integer division was the way to go with this.  I wanted to use perl, just because I'm trying to learn it right now, but perl only does float division.  So does JavaScript.  So I had to pull out a couple C manuals.

 
--- Code: ---#include

main()
{

int value;
int i;
int total=0;
int coins[5]={50,25,10,5,1};

printf("Enter an integer monetary value: \n");
scanf("%d", &value);

for(i=0; i

TheQuirk:
That's essentially what I was thinking about. You can do all this without a loop, however! I challenge youse guys.

worker201:
Unless you have some shifty if/else ladder in mind, I'm not sure what you're looking for.  Maybe a hint?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version