The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Hello, my favorite tutor! Â Can you please help me with this c program?
Â
Project 4, Program DesignImportant: the programs in this project will be graded based on whether the requiredfunctionality were implemented correctly instead of whether it produces the correct output, forthe functionality part (80% of the total grade)1.Modify Project 1 (dollar.c) (Write a C program that asks the user to enter a U.S. dollar amountand then shows how to pay that amount using the smallest number of $20, $10, $5, and $1bills.)So it includes the following function:void pay_amount(int dollars, int *twenties, int *tens, int*fives, int *ones);The function determines the smallest number of $20, $10, $5, and $1 bills necessary to paythe amount represented by thedollarsparameter. Thetwentiesparameter points toa variable in which the function will store the number of $20 bills required. Thetens,fives,andonesparameters are similar. Modify themainfunction so it callspay_amountto compute the smallest number of $20, $10, $5, and $1 bills. Themainfunction should display the result.2.Modify Project 2 (fraction.c) so it reduces the fraction to lowest terms:Enter two fractions separated by the operator: 4/9 – 1/9The result is: 1/3The program should include the following function:void reduce(int numerator, int denominator, int*reduced_numerator, int *reduced_denominator);numeratoranddenominatorare the numerator and denominator of a fraction.Reduced_numeratorandreduced_denominatorare pointers to variable in whichthe function will store the numerator and denominator of the fraction once it has beenreduced to lowest terms. Modify themainfunction so it callsreducebefore displayingthe result.To reduce a fraction to lowest terms, first compute the GCD (greatest common divisor) ofthe numerator and denominator. Then divide the numerator and denominator by the GCD.Add the following function to your program that finds the GCD of two numbers m and n:int find_gcd(int m, int n){if(n == 0) return m;return find_gcd(n, m%n);}
Attachments: