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
Jacob is a website designer. Whenever his company takes on a new project, Jacob takes the initiative and comes up with ideas and
Troyanec [42]
Eating a potato is what hes using
3 0
3 years ago
Select the correct answer.
Mekhanik [1.2K]
The best answer is A
5 0
3 years ago
Read 2 more answers
A function checkZeros accepts three double parameters. It checks to see if the sum of all three parameters is equal to zero. If
blagie [28]

Answer:

Explanation:

The following code is written in Java. It creates the interface/prototype, the function, and the main method call. The function takes in the three int parameters, adds them, and then checks if the sum equals zero, outputting the correct boolean value. Output can be seen in the picture attached below. Due to technical difficulties I had to add the code as a txt file below.

6 0
3 years ago
Is there apps/ websites like brainly?
Virty [35]

Answer:

Mathpix Snip, Socratic, Microsoft Math Solver....etc.

Explanation:

Hope this helps! :)

6 0
3 years ago
Read 2 more answers
Write the definition of a method dashedLine, with one parameter, an int. If the parameter is negative or zero, the method does n
ZanzabumX [31]

Answer:

import java.util.Scanner;

public class DashLine {

public static void main(String[] args) {

// Declaring variables

int n;

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

// Getting the input entered by the user

System.out.print("Enter a number :");

n = sc.nextInt();

// calling the method by passing the user entered input as argument

dashedLine(n);

}

//This method will print the dashed line for number greater than zer

private static void dashedLine(int n) {

if (n > 0) {

for (int i = 1; i <= n; i++) {

System.out.print("-");

}

System.out.println();

}

}

}

Explanation:

5 0
3 years ago
Other questions:
  • To insert notes into a worksheet, insert ________ in cells.
    15·1 answer
  • Which element of presentation software can you use to add callouts and banners?
    5·2 answers
  • WILL GIVE BRAINLIEST TO FIRST AND BEST ANSWER!
    10·1 answer
  • 1). What is the proper name of the healing agent?
    5·1 answer
  • Consider the following code: x = 17 y = 5 print (x % y) What is output?
    10·1 answer
  • Assignment 4: Evens and Odds<br><br><br> How do I fix this?
    13·1 answer
  • How do you create multiple columns in Word?
    12·1 answer
  • A student can improve performance by decreasing
    14·1 answer
  • Make variables to represent the length and width of a rectangle, called length and width, respectively. You should set length to
    7·1 answer
  • What component of a change management program includes final testing that the software functions properly
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!