Question
This is C program (a) Create a file called hello.c, that, when compiled and run, prints out Hello World! Add one line of meaningful comment
This is C program
(a) Create a file called hello.c, that, when compiled and run, prints out "Hello World!"
Add one line of meaningful comment in your code
Once you have written hello.c, you should be able to compile it with gcc:
$ gcc -o hello hello.c
The command above should produce a hello executable that you can run with
$ ./hello
(b)Copy the hello.c file to a new file called change.c. Replace the main method with a function
with the following signature:
void printChange(int change);
Flesh out this function such that when it is called, it will print out the minimum number of American coins that sum
up to that amount (using quarters, dimes, nickels and pennies).
For instance, if the function were called as printChange(73), the expected output is:
73 cents in change:
-2 quarters
-2 dimes
-0 nickels
-3 pennies
Note that no nickels were required for that example. Use Exactly that format, i.e, print out "X cents in change:", a new line, then a line for each type of coin.
You may assume that the amount of change given to the function will never be negative.
To test the printChange method, compile it with:
gcc main_change.c change.h change.c -o change
and then type ./change
The file main change.c, included in your starter code,
tests printChange on a few values. You should add more tests to make sure your function works properly.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started