Explore BrainMass

complete C code for calculating total currency

I have been working on this tutorial for awhile now. I will state what the output should look like.
My program will do some computation with two numbers.

The two numbers used by this program are 22 and 16.

The Sum of 22 and 16 is 61
The Difference of 22 minus 16 is 11
The Product of 22 times 16 is 900
When 22 is divided by 16 you get 1 with remainder 11

If you have 22 nickels and 16 pennies you would have $2.05

Thank you for using this program.

I have the 1st two statements figured out, and had the arithmetic figured out based on results of 22 and 16, but turns out I interpreted it wrong and results should be what's posted above when the user changes the two numbers. The tutorial says not to use scan or flush. Should a put in code stating to Please enter a number? I am a little unsure of what to do about the float. I know to use the float and to put it as %.2f, but after that unsure. Any help would be appreciated. I will attach what I have. ( I am probably making this harder than it actually is). Oh, and should compile in C.

© BrainMass Inc. brainmass.com August 14, 2018, 6:18 am ad1c9bdddf


Solution Summary

The solution gives a complete C code for calculating total currency containing nickel and penny.