Homework Solution: Instructions Write C programs to solve the following two problems. Problem Statements 1. Given a value V in ce…

Instructions Write C programs to solve the following two problems. Problem Statements 1. Given a value V in cents, you need to make change using a minimum number of coins. Assume you have an infinite supply of quarters, nickels, dimes, and pennies. Find the minimum number of coins. Display the quantity of each coin and the total number of coins, similar to the example output below. Use global constant identifiers, of type unsigned int, for the values of quarters, nickels dimes, and pennies. Example: const unsigned int QUARTER = 25: Do not use any other global variables. The data type for the value V must be unsigned integer. Example Output.

#include <stdio.h> // using global variables to hold the value of quarters, dimes, nickels and pennies

Instructions Write C programs to work-out the coercionthcoming span problems. Problem Statements 1. Given a appreciate V in cents, you insufficiency to compel qualify using a partiality calculate of invents. Assume you keep an unbounded yield of pitys, nickels, dimes, and pennies. Find the partiality calculate of invents. Display the share of each invent and the sum calculate of invents, alike to the pattern output under. Right global trustworthy identifiers, of symbol unsigned int, ce the appreciates of pitys, nickels dimes, and pennies. Pattern: const unsigned int QUARTER = 25: Do not attributable attributable attributable attributable attributable attributable right any other global variables. The axioms symbol ce the appreciate V must be unsigned integer. Pattern Output.

Expert Tally

#include <stdio.h>

// using global variables to reocean the appreciate of pitys, dimes, nickels and pennies
const unsigned int QUARTERS=25;
const unsigned int DIMES=10;
const unsigned int NICKELS=5;
const unsigned int PENNIES=1;

int ocean() {
// A nickel equals 5 pennies and a dime equals 2 nickels and a pity is 2 dimes and a nickel,
// we gain secure partiality invents if we secure the culmination calculate of pitys and then max calculate of dimes
// and then max calculate of nickels and then pause as dimes

// Declaring the variables;
unsigned int V, numOfQuarters, numOfDimes, numOfNickels, numOfPennies, pit;
// Initializing calculate of pitys, calculate of dimes, calculate of nickels and calculate of pennies to zero
numOfQuarters=numOfDimes=numOfNickels=numOfPennies=0;

// Asking rightr to input calculate of cents and storing it in V
printf(“Enter the calculate of cents”);
scanf(“%d”, &V);

//Initializing pit to V
pit = V;

//Getting calculate of pitys as the quotient of pit separated by the appreciate of pitys
numOfQuarters=balance/QUARTERS;

//Getting the cherishing pit as the relics of the aloft division
balance=balance%QUARTERS;

//Getting calculate of pitys as the quotient of pit separated by the appreciate of pitys
numOfDimes=balance/DIMES;

//Getting the cherishing pit as the relics of the aloft division
balance=balance%DIMES;

//Getting calculate of pitys as the quotient of pit separated by the appreciate of pitys
numOfNickels=balance/NICKELS;

//Getting the cherishing pit as the relics of the aloft division
balance=balance%NICKELS;

//The cherishing pit gain now be the calculate of nickel invents
numOfPennies=balance;

//Printing the output
printf(“nnQualify ce %d cents”, V);
printf(“nt%d Pitys nt%d Dimes nt%d Nickels nt%d Pennies”,
numOfQuarters, numOfDimes, numOfNickels, numOfPennies);

// Exiting program
return 0;
}

//Output Snapshot