SlideShare une entreprise Scribd logo
1  sur  2
Télécharger pour lire hors ligne
1. Write a C program, change.c, which computes the minimum number of bills and coins needed
to make change for a particular purchases. The cost of the item is $ 21.15 and the amount
tendered is $ 100.00. These values should be built into your program using assignment
statements rather than input into the program during program runtime. Your program should
indicate how many bills and coins of each denomination are needed for the change. You should
make use of the following denominations: Bills: Twenty, ten, five, one Coins: quarter, dime,
nickel, penny Use interger division and modulus operator. Do not use subtraction in place of the
modulus operator. Note that it will be easier to convert the cost and amount tendered into pennies
so you can work with integers rather than doubles.
Solution
#include<stdio.h>
//function prototype
void change(int amount, int *dollar, int *quarters,int *dimes,int *nickels,int *pennies);
int main(){
int amount, due;
int dollar, quarters, dimes, nickels, pennies;
printf("Enter cost amount(in pennies): ");
scanf("%d", &due);
printf("Enter tendered amount(in pennies): ");
scanf("%d", &amount);
change((amount-due), &dollar, &quarters, &dimes, &nickels, &pennies);
printf("Dollars: %d ", dollar);
printf("Quarters: %d ", quarters);
printf("Dimes: %d ", dimes);
printf("Nickels: %d ", nickels);
printf("Pennies: %d ", pennies);
return 0;
}
//function defination
void change(int amount, int *dollar, int *quarters,int *dimes,int *nickels,int *pennies){
*dollar = amount/100;
amount = amount%100;
*quarters = amount/25;
amount = amount%25;
*dimes = amount/10;
amount = amount%10;
*nickels = amount/5;
amount = amount%5;
*pennies = amount;
}

Contenu connexe

Similaire à 1- Write a C program- change-c- which computes the minimum number of b.docx

Programming - C++
Programming - C++Programming - C++
Programming - C++Aoun10
 
Need help on these- Task 2-3-4 Task -#2 The if-else-if Statement 1- Wr.docx
Need help on these- Task 2-3-4 Task -#2 The if-else-if Statement 1- Wr.docxNeed help on these- Task 2-3-4 Task -#2 The if-else-if Statement 1- Wr.docx
Need help on these- Task 2-3-4 Task -#2 The if-else-if Statement 1- Wr.docxLucasmHKChapmant
 
I cant get the pictures to be any more clear. Thats as clear as the.pdf
I cant get the pictures to be any more clear. Thats as clear as the.pdfI cant get the pictures to be any more clear. Thats as clear as the.pdf
I cant get the pictures to be any more clear. Thats as clear as the.pdfallystraders
 
For this assignment- you will write a C++ program that asks the user t.docx
For this assignment- you will write a C++ program that asks the user t.docxFor this assignment- you will write a C++ program that asks the user t.docx
For this assignment- you will write a C++ program that asks the user t.docxEvanY5VMacLeodq
 
Goals• to use a sentinel controlled loop• to use functionsLoa.pdf
Goals• to use a sentinel controlled loop• to use functionsLoa.pdfGoals• to use a sentinel controlled loop• to use functionsLoa.pdf
Goals• to use a sentinel controlled loop• to use functionsLoa.pdfhainesburchett26321
 
Introduction- Water conservation is one of the most pertinent issues i (1).pdf
Introduction- Water conservation is one of the most pertinent issues i (1).pdfIntroduction- Water conservation is one of the most pertinent issues i (1).pdf
Introduction- Water conservation is one of the most pertinent issues i (1).pdfvishalateen
 
Intro To C++ - Cass 11 - Converting between types, formatting floating point,...
Intro To C++ - Cass 11 - Converting between types, formatting floating point,...Intro To C++ - Cass 11 - Converting between types, formatting floating point,...
Intro To C++ - Cass 11 - Converting between types, formatting floating point,...Blue Elephant Consulting
 
Intro To C++ - Class 11 - Converting between types, formatting floating point...
Intro To C++ - Class 11 - Converting between types, formatting floating point...Intro To C++ - Class 11 - Converting between types, formatting floating point...
Intro To C++ - Class 11 - Converting between types, formatting floating point...Blue Elephant Consulting
 
Write a C# program to compute the charge for a motel room. This pr.docx
Write a C# program to compute the charge for a motel room. This pr.docxWrite a C# program to compute the charge for a motel room. This pr.docx
Write a C# program to compute the charge for a motel room. This pr.docxsyreetamacaulay
 
The Program must ask the user to enter the amount owed, tha.docx
 The Program must ask the user to enter the amount owed, tha.docx The Program must ask the user to enter the amount owed, tha.docx
The Program must ask the user to enter the amount owed, tha.docxKomlin1
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxAASTHA76
 
Implement the programming problems below. Submit the source code and .pdf
Implement the programming problems below. Submit the source code and .pdfImplement the programming problems below. Submit the source code and .pdf
Implement the programming problems below. Submit the source code and .pdfinfo961251
 

Similaire à 1- Write a C program- change-c- which computes the minimum number of b.docx (20)

Programming - C++
Programming - C++Programming - C++
Programming - C++
 
L03vars
L03varsL03vars
L03vars
 
Need help on these- Task 2-3-4 Task -#2 The if-else-if Statement 1- Wr.docx
Need help on these- Task 2-3-4 Task -#2 The if-else-if Statement 1- Wr.docxNeed help on these- Task 2-3-4 Task -#2 The if-else-if Statement 1- Wr.docx
Need help on these- Task 2-3-4 Task -#2 The if-else-if Statement 1- Wr.docx
 
keyword
keywordkeyword
keyword
 
keyword
keywordkeyword
keyword
 
Chapter2
Chapter2Chapter2
Chapter2
 
I cant get the pictures to be any more clear. Thats as clear as the.pdf
I cant get the pictures to be any more clear. Thats as clear as the.pdfI cant get the pictures to be any more clear. Thats as clear as the.pdf
I cant get the pictures to be any more clear. Thats as clear as the.pdf
 
For this assignment- you will write a C++ program that asks the user t.docx
For this assignment- you will write a C++ program that asks the user t.docxFor this assignment- you will write a C++ program that asks the user t.docx
For this assignment- you will write a C++ program that asks the user t.docx
 
Goals• to use a sentinel controlled loop• to use functionsLoa.pdf
Goals• to use a sentinel controlled loop• to use functionsLoa.pdfGoals• to use a sentinel controlled loop• to use functionsLoa.pdf
Goals• to use a sentinel controlled loop• to use functionsLoa.pdf
 
C programming
C programmingC programming
C programming
 
C programming
C programmingC programming
C programming
 
Introduction- Water conservation is one of the most pertinent issues i (1).pdf
Introduction- Water conservation is one of the most pertinent issues i (1).pdfIntroduction- Water conservation is one of the most pertinent issues i (1).pdf
Introduction- Water conservation is one of the most pertinent issues i (1).pdf
 
Introduction to Procedural Programming in C++
Introduction to Procedural Programming in C++Introduction to Procedural Programming in C++
Introduction to Procedural Programming in C++
 
Intro To C++ - Cass 11 - Converting between types, formatting floating point,...
Intro To C++ - Cass 11 - Converting between types, formatting floating point,...Intro To C++ - Cass 11 - Converting between types, formatting floating point,...
Intro To C++ - Cass 11 - Converting between types, formatting floating point,...
 
Intro To C++ - Class 11 - Converting between types, formatting floating point...
Intro To C++ - Class 11 - Converting between types, formatting floating point...Intro To C++ - Class 11 - Converting between types, formatting floating point...
Intro To C++ - Class 11 - Converting between types, formatting floating point...
 
Write a C# program to compute the charge for a motel room. This pr.docx
Write a C# program to compute the charge for a motel room. This pr.docxWrite a C# program to compute the charge for a motel room. This pr.docx
Write a C# program to compute the charge for a motel room. This pr.docx
 
The Program must ask the user to enter the amount owed, tha.docx
 The Program must ask the user to enter the amount owed, tha.docx The Program must ask the user to enter the amount owed, tha.docx
The Program must ask the user to enter the amount owed, tha.docx
 
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docxBottom of FormCreate your own FunctionFunctionsFor eac.docx
Bottom of FormCreate your own FunctionFunctionsFor eac.docx
 
Chapter 2- Prog101.ppt
Chapter 2- Prog101.pptChapter 2- Prog101.ppt
Chapter 2- Prog101.ppt
 
Implement the programming problems below. Submit the source code and .pdf
Implement the programming problems below. Submit the source code and .pdfImplement the programming problems below. Submit the source code and .pdf
Implement the programming problems below. Submit the source code and .pdf
 

Plus de todd991

12-8 On August 3- 2014- the firm of Chapelle- Rock- and Pryor decided.docx
12-8 On August 3- 2014- the firm of Chapelle- Rock- and Pryor decided.docx12-8 On August 3- 2014- the firm of Chapelle- Rock- and Pryor decided.docx
12-8 On August 3- 2014- the firm of Chapelle- Rock- and Pryor decided.docxtodd991
 
16 Additional data obtained from an examination of the accounts in the.docx
16 Additional data obtained from an examination of the accounts in the.docx16 Additional data obtained from an examination of the accounts in the.docx
16 Additional data obtained from an examination of the accounts in the.docxtodd991
 
16- Here is a recursive method that returns the smallest character in.docx
16- Here is a recursive method that returns the smallest character in.docx16- Here is a recursive method that returns the smallest character in.docx
16- Here is a recursive method that returns the smallest character in.docxtodd991
 
14-30 (Substantive tests of accounts receivable) The following situati.docx
14-30 (Substantive tests of accounts receivable) The following situati.docx14-30 (Substantive tests of accounts receivable) The following situati.docx
14-30 (Substantive tests of accounts receivable) The following situati.docxtodd991
 
14- Which of the following is the correct name for NalICO- A- Sodiuns.docx
14- Which of the following is the correct name for NalICO- A- Sodiuns.docx14- Which of the following is the correct name for NalICO- A- Sodiuns.docx
14- Which of the following is the correct name for NalICO- A- Sodiuns.docxtodd991
 
14- Consider the following pairs of frequencies- i- 200 Hz- 304 Hz ii-.docx
14- Consider the following pairs of frequencies- i- 200 Hz- 304 Hz ii-.docx14- Consider the following pairs of frequencies- i- 200 Hz- 304 Hz ii-.docx
14- Consider the following pairs of frequencies- i- 200 Hz- 304 Hz ii-.docxtodd991
 
14 Income tax is estimated at 40- of income- What factors other than e.docx
14 Income tax is estimated at 40- of income- What factors other than e.docx14 Income tax is estimated at 40- of income- What factors other than e.docx
14 Income tax is estimated at 40- of income- What factors other than e.docxtodd991
 
14- Under the direct charge-off method of dealing with uncollectible a.docx
14- Under the direct charge-off method of dealing with uncollectible a.docx14- Under the direct charge-off method of dealing with uncollectible a.docx
14- Under the direct charge-off method of dealing with uncollectible a.docxtodd991
 
13) In the table below- fl in the name and formula for the oxyanions i.docx
13) In the table below- fl in the name and formula for the oxyanions i.docx13) In the table below- fl in the name and formula for the oxyanions i.docx
13) In the table below- fl in the name and formula for the oxyanions i.docxtodd991
 
12-19 Notes Compare and contrast the Hubble Space Telescope with James.docx
12-19 Notes Compare and contrast the Hubble Space Telescope with James.docx12-19 Notes Compare and contrast the Hubble Space Telescope with James.docx
12-19 Notes Compare and contrast the Hubble Space Telescope with James.docxtodd991
 
13- The molecule below shows five distinct signals on -'H-NMR- Fill in.docx
13- The molecule below shows five distinct signals on -'H-NMR- Fill in.docx13- The molecule below shows five distinct signals on -'H-NMR- Fill in.docx
13- The molecule below shows five distinct signals on -'H-NMR- Fill in.docxtodd991
 
13 Wallace Inc-- a developer of radiology equipment- has stock outstan (1).docx
13 Wallace Inc-- a developer of radiology equipment- has stock outstan (1).docx13 Wallace Inc-- a developer of radiology equipment- has stock outstan (1).docx
13 Wallace Inc-- a developer of radiology equipment- has stock outstan (1).docxtodd991
 
12-5 Distribution of Cash Upon Liquidation Manley and Singh are partne.docx
12-5 Distribution of Cash Upon Liquidation Manley and Singh are partne.docx12-5 Distribution of Cash Upon Liquidation Manley and Singh are partne.docx
12-5 Distribution of Cash Upon Liquidation Manley and Singh are partne.docxtodd991
 
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod (1).docx
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod (1).docx11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod (1).docx
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod (1).docxtodd991
 
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod.docx
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod.docx11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod.docx
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod.docxtodd991
 
12- It is a term used in chemistry- to describe a system in which a or.docx
12- It is a term used in chemistry- to describe a system in which a or.docx12- It is a term used in chemistry- to describe a system in which a or.docx
12- It is a term used in chemistry- to describe a system in which a or.docxtodd991
 
11- Packer Company- which has only one product- has provided the follo.docx
11- Packer Company- which has only one product- has provided the follo.docx11- Packer Company- which has only one product- has provided the follo.docx
11- Packer Company- which has only one product- has provided the follo.docxtodd991
 
11-23 (Objective 11-2) During audit planning- an auditor obtained the.docx
11-23 (Objective 11-2) During audit planning- an auditor obtained the.docx11-23 (Objective 11-2) During audit planning- an auditor obtained the.docx
11-23 (Objective 11-2) During audit planning- an auditor obtained the.docxtodd991
 
10- Which of the following statements is correct- Select one- a- Metho.docx
10- Which of the following statements is correct- Select one- a- Metho.docx10- Which of the following statements is correct- Select one- a- Metho.docx
10- Which of the following statements is correct- Select one- a- Metho.docxtodd991
 
10- Consider the following data structure used for implementing a link.docx
10- Consider the following data structure used for implementing a link.docx10- Consider the following data structure used for implementing a link.docx
10- Consider the following data structure used for implementing a link.docxtodd991
 

Plus de todd991 (20)

12-8 On August 3- 2014- the firm of Chapelle- Rock- and Pryor decided.docx
12-8 On August 3- 2014- the firm of Chapelle- Rock- and Pryor decided.docx12-8 On August 3- 2014- the firm of Chapelle- Rock- and Pryor decided.docx
12-8 On August 3- 2014- the firm of Chapelle- Rock- and Pryor decided.docx
 
16 Additional data obtained from an examination of the accounts in the.docx
16 Additional data obtained from an examination of the accounts in the.docx16 Additional data obtained from an examination of the accounts in the.docx
16 Additional data obtained from an examination of the accounts in the.docx
 
16- Here is a recursive method that returns the smallest character in.docx
16- Here is a recursive method that returns the smallest character in.docx16- Here is a recursive method that returns the smallest character in.docx
16- Here is a recursive method that returns the smallest character in.docx
 
14-30 (Substantive tests of accounts receivable) The following situati.docx
14-30 (Substantive tests of accounts receivable) The following situati.docx14-30 (Substantive tests of accounts receivable) The following situati.docx
14-30 (Substantive tests of accounts receivable) The following situati.docx
 
14- Which of the following is the correct name for NalICO- A- Sodiuns.docx
14- Which of the following is the correct name for NalICO- A- Sodiuns.docx14- Which of the following is the correct name for NalICO- A- Sodiuns.docx
14- Which of the following is the correct name for NalICO- A- Sodiuns.docx
 
14- Consider the following pairs of frequencies- i- 200 Hz- 304 Hz ii-.docx
14- Consider the following pairs of frequencies- i- 200 Hz- 304 Hz ii-.docx14- Consider the following pairs of frequencies- i- 200 Hz- 304 Hz ii-.docx
14- Consider the following pairs of frequencies- i- 200 Hz- 304 Hz ii-.docx
 
14 Income tax is estimated at 40- of income- What factors other than e.docx
14 Income tax is estimated at 40- of income- What factors other than e.docx14 Income tax is estimated at 40- of income- What factors other than e.docx
14 Income tax is estimated at 40- of income- What factors other than e.docx
 
14- Under the direct charge-off method of dealing with uncollectible a.docx
14- Under the direct charge-off method of dealing with uncollectible a.docx14- Under the direct charge-off method of dealing with uncollectible a.docx
14- Under the direct charge-off method of dealing with uncollectible a.docx
 
13) In the table below- fl in the name and formula for the oxyanions i.docx
13) In the table below- fl in the name and formula for the oxyanions i.docx13) In the table below- fl in the name and formula for the oxyanions i.docx
13) In the table below- fl in the name and formula for the oxyanions i.docx
 
12-19 Notes Compare and contrast the Hubble Space Telescope with James.docx
12-19 Notes Compare and contrast the Hubble Space Telescope with James.docx12-19 Notes Compare and contrast the Hubble Space Telescope with James.docx
12-19 Notes Compare and contrast the Hubble Space Telescope with James.docx
 
13- The molecule below shows five distinct signals on -'H-NMR- Fill in.docx
13- The molecule below shows five distinct signals on -'H-NMR- Fill in.docx13- The molecule below shows five distinct signals on -'H-NMR- Fill in.docx
13- The molecule below shows five distinct signals on -'H-NMR- Fill in.docx
 
13 Wallace Inc-- a developer of radiology equipment- has stock outstan (1).docx
13 Wallace Inc-- a developer of radiology equipment- has stock outstan (1).docx13 Wallace Inc-- a developer of radiology equipment- has stock outstan (1).docx
13 Wallace Inc-- a developer of radiology equipment- has stock outstan (1).docx
 
12-5 Distribution of Cash Upon Liquidation Manley and Singh are partne.docx
12-5 Distribution of Cash Upon Liquidation Manley and Singh are partne.docx12-5 Distribution of Cash Upon Liquidation Manley and Singh are partne.docx
12-5 Distribution of Cash Upon Liquidation Manley and Singh are partne.docx
 
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod (1).docx
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod (1).docx11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod (1).docx
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod (1).docx
 
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod.docx
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod.docx11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod.docx
11-5 Accrued Product Warranty Lowe Manufacturing Co- warrants its prod.docx
 
12- It is a term used in chemistry- to describe a system in which a or.docx
12- It is a term used in chemistry- to describe a system in which a or.docx12- It is a term used in chemistry- to describe a system in which a or.docx
12- It is a term used in chemistry- to describe a system in which a or.docx
 
11- Packer Company- which has only one product- has provided the follo.docx
11- Packer Company- which has only one product- has provided the follo.docx11- Packer Company- which has only one product- has provided the follo.docx
11- Packer Company- which has only one product- has provided the follo.docx
 
11-23 (Objective 11-2) During audit planning- an auditor obtained the.docx
11-23 (Objective 11-2) During audit planning- an auditor obtained the.docx11-23 (Objective 11-2) During audit planning- an auditor obtained the.docx
11-23 (Objective 11-2) During audit planning- an auditor obtained the.docx
 
10- Which of the following statements is correct- Select one- a- Metho.docx
10- Which of the following statements is correct- Select one- a- Metho.docx10- Which of the following statements is correct- Select one- a- Metho.docx
10- Which of the following statements is correct- Select one- a- Metho.docx
 
10- Consider the following data structure used for implementing a link.docx
10- Consider the following data structure used for implementing a link.docx10- Consider the following data structure used for implementing a link.docx
10- Consider the following data structure used for implementing a link.docx
 

Dernier

Department of Health Compounder Question ‍Solution 2022.pdf
Department of Health Compounder Question ‍Solution 2022.pdfDepartment of Health Compounder Question ‍Solution 2022.pdf
Department of Health Compounder Question ‍Solution 2022.pdfMohonDas
 
Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.EnglishCEIPdeSigeiro
 
Work Experience for psp3 portfolio sasha
Work Experience for psp3 portfolio sashaWork Experience for psp3 portfolio sasha
Work Experience for psp3 portfolio sashasashalaycock03
 
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfYu Kanazawa / Osaka University
 
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...Dr. Asif Anas
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRATanmoy Mishra
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?TechSoup
 
Vani Magazine - Quarterly Magazine of Seshadripuram Educational Trust
Vani Magazine - Quarterly Magazine of Seshadripuram Educational TrustVani Magazine - Quarterly Magazine of Seshadripuram Educational Trust
Vani Magazine - Quarterly Magazine of Seshadripuram Educational TrustSavipriya Raghavendra
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfMohonDas
 
How to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeHow to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeCeline George
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxiammrhaywood
 
How to Create a Toggle Button in Odoo 17
How to Create a Toggle Button in Odoo 17How to Create a Toggle Button in Odoo 17
How to Create a Toggle Button in Odoo 17Celine George
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxAditiChauhan701637
 
A gentle introduction to Artificial Intelligence
A gentle introduction to Artificial IntelligenceA gentle introduction to Artificial Intelligence
A gentle introduction to Artificial IntelligenceApostolos Syropoulos
 
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSyedNadeemGillANi
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxraviapr7
 
3.26.24 Race, the Draft, and the Vietnam War.pptx
3.26.24 Race, the Draft, and the Vietnam War.pptx3.26.24 Race, the Draft, and the Vietnam War.pptx
3.26.24 Race, the Draft, and the Vietnam War.pptxmary850239
 
Protein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxProtein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxvidhisharma994099
 
Ultra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxUltra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxDr. Asif Anas
 

Dernier (20)

Department of Health Compounder Question ‍Solution 2022.pdf
Department of Health Compounder Question ‍Solution 2022.pdfDepartment of Health Compounder Question ‍Solution 2022.pdf
Department of Health Compounder Question ‍Solution 2022.pdf
 
Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.
 
Work Experience for psp3 portfolio sasha
Work Experience for psp3 portfolio sashaWork Experience for psp3 portfolio sasha
Work Experience for psp3 portfolio sasha
 
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
 
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...
Unveiling the Intricacies of Leishmania donovani: Structure, Life Cycle, Path...
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?
 
Vani Magazine - Quarterly Magazine of Seshadripuram Educational Trust
Vani Magazine - Quarterly Magazine of Seshadripuram Educational TrustVani Magazine - Quarterly Magazine of Seshadripuram Educational Trust
Vani Magazine - Quarterly Magazine of Seshadripuram Educational Trust
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdf
 
How to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using CodeHow to Send Emails From Odoo 17 Using Code
How to Send Emails From Odoo 17 Using Code
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
 
How to Create a Toggle Button in Odoo 17
How to Create a Toggle Button in Odoo 17How to Create a Toggle Button in Odoo 17
How to Create a Toggle Button in Odoo 17
 
In - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptxIn - Vivo and In - Vitro Correlation.pptx
In - Vivo and In - Vitro Correlation.pptx
 
Prelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quizPrelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quiz
 
A gentle introduction to Artificial Intelligence
A gentle introduction to Artificial IntelligenceA gentle introduction to Artificial Intelligence
A gentle introduction to Artificial Intelligence
 
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptxSOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
SOLIDE WASTE in Cameroon,,,,,,,,,,,,,,,,,,,,,,,,,,,.pptx
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptx
 
3.26.24 Race, the Draft, and the Vietnam War.pptx
3.26.24 Race, the Draft, and the Vietnam War.pptx3.26.24 Race, the Draft, and the Vietnam War.pptx
3.26.24 Race, the Draft, and the Vietnam War.pptx
 
Protein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptxProtein Structure - threading Protein modelling pptx
Protein Structure - threading Protein modelling pptx
 
Ultra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxUltra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptx
 

1- Write a C program- change-c- which computes the minimum number of b.docx

  • 1. 1. Write a C program, change.c, which computes the minimum number of bills and coins needed to make change for a particular purchases. The cost of the item is $ 21.15 and the amount tendered is $ 100.00. These values should be built into your program using assignment statements rather than input into the program during program runtime. Your program should indicate how many bills and coins of each denomination are needed for the change. You should make use of the following denominations: Bills: Twenty, ten, five, one Coins: quarter, dime, nickel, penny Use interger division and modulus operator. Do not use subtraction in place of the modulus operator. Note that it will be easier to convert the cost and amount tendered into pennies so you can work with integers rather than doubles. Solution #include<stdio.h> //function prototype void change(int amount, int *dollar, int *quarters,int *dimes,int *nickels,int *pennies); int main(){ int amount, due; int dollar, quarters, dimes, nickels, pennies; printf("Enter cost amount(in pennies): "); scanf("%d", &due); printf("Enter tendered amount(in pennies): "); scanf("%d", &amount); change((amount-due), &dollar, &quarters, &dimes, &nickels, &pennies); printf("Dollars: %d ", dollar); printf("Quarters: %d ", quarters); printf("Dimes: %d ", dimes); printf("Nickels: %d ", nickels);
  • 2. printf("Pennies: %d ", pennies); return 0; } //function defination void change(int amount, int *dollar, int *quarters,int *dimes,int *nickels,int *pennies){ *dollar = amount/100; amount = amount%100; *quarters = amount/25; amount = amount%25; *dimes = amount/10; amount = amount%10; *nickels = amount/5; amount = amount%5; *pennies = amount; }