1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
siniylev [52]
3 years ago
14

Write a C program that asks the user to enter a US dollar amount and then shows how to pay that amount using the smallest number

of $20,$10,$5 and $1 bills. Enter a dollar amount: 93
$20 bills: 4

$10 bills: 1

$5 bills: 0

$1 bills: 3
Computers and Technology
1 answer:
Eduardwww [97]3 years ago
8 0

Here is code in C.

#include <stdio.h>

//main function

int main(void)

{   //variable to store input amount

int amount;

printf("Enter a dollar amount:");

//reading the input amount

scanf("%d",&amount);

//calcutating and printing the $20 bills

printf("\n$20 bills:%d",amount/20);

//update the amount After reducing the $20 bills

amount=amount%20;

//calcutating and printing the $10 bills

printf("\n$10 bills:%d",amount/10);

 //update the amount After reducing the $10 bills

amount=amount%10;

//calcutating and printing the $5 bills

printf("\n$5 bills:%d",amount/5);

 //update the amount After reducing the $5 bills

amount=amount%5;

//calcutating and printing the $1 bills

printf("\n$1 bills:%d",amount/1);

return 0;

}

Explanation:

According to the code, first it will ask user to give input amount.Then it will find the total bills for $20 and print that number, then it update the amount value after reducing them from the amount.Then it will calculate total bills for $10 and print that number then it updates the amount after reducing them from amount.Similarly it will calculate for $5 bills and $1 bills and print their values.

Output:

Enter a dollar amount:93

bills of $20 :4

bills of $10 :1

bills of $5 :0

bills of $1 :3

You might be interested in
After the following code is executed what will be displayed on the screen? bool correntEmployee = true; double empSalary = 45000
AlexFokin [52]

Answer:

"The employee pay rate is normal" is the correct answer for the above question.

Explanation:

  • The above question code is written in the c++ language, in which there is one variable of bool type whose value is true.
  • And this variable is also tested in the if-condition which gives the true and the if-body will be executed.
  • Then the internal if-condition will give the false result because the value of the empsalary is not less than 45000. It is because the above statement "empsalary=45000" will assign the value 45000 on the empsalary variable.
  • Then the else block will be executed which prints "the employee pay rate is normal".

7 0
3 years ago
What is the extension of Qbasic ?​
abruzzese [7]

There are four types of operator in QBASIC. They are Arithmetic operators,relational operators,logical operators and sting operator .a. arithmetic operators. Arithmetic operators are used to preform mathematical calculations like addition, subtraction, division, multiplication and exponential

7 0
3 years ago
Read 2 more answers
Demographics and psychographics influence database marketing.<br><br><br> False<br><br> True
Kamila [148]

Answer:

true is the correct answer

5 0
3 years ago
A series of inventions led to the creation of the electronic digital computer shortly after this war..
lesantik [10]
What is world war 2? bob
4 0
3 years ago
In this assignment, you will develop a C++ program and a flowchart that calculates a cost to replace all tablets and desktop com
Alexeev081 [22]

Answer:

Explanation:

The objective of this program we are to develop is to compute a C++ program and a flowchart that calculates a cost to replace all tablets and desktop computers in a business.

C++ Program

#include<iostream>

#include<iomanip>

using namespace std;

/*

⦁ // Name:

⦁ // Date:

⦁ // Program Name:

⦁ // Description:

*/

int main()

{

const double SalesTaxRate = .075, DiscountPercent = .10, FinanceCharge = .15;

const double TABLET = 320.00, DESKTOP = 800.00;

double total = 0.0, subTotal = 0.0,avg=0.0;

int numberOfTablets, numberOfDesktop;

cout << "-------------- Welcome to Computer Selling Company ------------------ ";

cout << "Enter number of tablets: ";

cin >> numberOfTablets;

cout << "Enter number of desktops: ";

cin >> numberOfDesktop;

subTotal = TABLET * numberOfTablets + numberOfDesktop * DESKTOP;

char choice;

cout << "Paying cash or financing: (c/f): ";

cin >> choice;

cout << fixed << setprecision(2);

if (choice == 'c' || choice == 'C')

{

cout << "You have choosen paying cash." << endl;

total = subTotal - subTotal * DiscountPercent;

cout << "Discount you get $" << subTotal * DiscountPercent<<endl;

cout << "Sales Tax: $" << SalesTaxRate * total << endl;

total = total + total * SalesTaxRate;

cout << "Total computers' Cost: $" << total << endl;

avg = total / (numberOfDesktop + numberOfTablets);

cout << "Average computer cost: $ " << avg << endl;

}

else if (choice == 'f' || choice == 'F')

{

cout << "You have choosen Finance option." << endl;

total = subTotal + subTotal * FinanceCharge;

cout << "Finance Charge $" << subTotal * FinanceCharge << endl;

cout << "Sales Tax: $" << SalesTaxRate * total << endl;

total = total + total * SalesTaxRate;

cout << "Total computers' Cost: $" << total << endl;

avg = total / (numberOfDesktop + numberOfTablets);

cout << "Average computer cost: $ " << avg << endl;

}

else

{

cout << "Wrong choice.......Existing.... ";

system("pause");

}

//to hold the output screen

system("pause");

} }

OUTPUT:

The Output of the program is shown in the first data file attached below:

FLOWCHART:

See the second diagram attached for the designed flowchart.

5 0
3 years ago
Other questions:
  • In the two-level directory, if a user refers to a particular file then__________________ Select one: a. only his/her own UFD (us
    7·1 answer
  • Your desktop computer monitor is not displaying a picture. What would you do to troubleshoot the problem?
    7·2 answers
  • Lux Ladies, Inc., is a company that specializes in expensive and unusual gifts for all occasions. It keeps a large file of infor
    11·1 answer
  • Please Do Solve it guys...
    6·1 answer
  • Do you really think our life applications and OSs will be open source at the end for everything?
    11·1 answer
  • Given two int variables , firstplacewinner and secondplacewinner, write some code that swaps their values . declare any addition
    11·1 answer
  • Sean Cody is a website most known for what?
    9·2 answers
  • One last question
    7·2 answers
  • One of 34 possible _________________ can be assigned to each axis of classification in the seven-character code.
    12·1 answer
  • What is bigger that terbites
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!