Problem07-10.pptx

  • Uploaded by: Jan Ryan R. Relunia
  • 0
  • 0
  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Problem07-10.pptx as PDF for free.

More details

  • Words: 279
  • Pages: 5
PROBLEM07 - 10

PROBLEM07.CPP • Factoring of integers. Write a program that asks the user for an integer and then prints out all its factors. For example, when the user enters 150, the program should print 2 3 5 5 • Use a function that generates the factors of the entered integer. Your program should allow the user to repeat this calculation as often as the user wishes.

PROBLEM08.CPP • Write a program for an Automated Teller machine that dispenses money. The user should enter the amount desired and the machine dispenses this amount using the least number of bills. The bills dispensed are 1000s, 500s,, 200s, 100s50s and 20s. Create a function that computes the denomination of the entered amount provided by the user.

PROBLEM09.CPP • Write a function separate() that separates a number into three parts: a sign(+ , -, or blank), a whole number magnitude and a fractional part. Develop a program that tests the separate() function. • Hint: Use the floor(x) function to get the nearest value <= x Sample Run: Input a number? –3.44 RESULT: Sign: Integer Part: 3.0 Fractional Part: 0.44

PROBLEM10.CPP

• Given the coefficients a, b and c, the Quadratic Formula provided below can be used to determine the roots (the values of x1 and x2) of an equation of the form ax2+bx+c=0.

Write a C++ program that asks the user for the values of coefficients a, b and c and write a function that computes the roots of the equation. Sample Run: QUADRATIC FORMULA ------------------------Input coefficient a? 1 ◄┘ Input coefficient b? 7 ◄┘ Input coefficient c? 12 ◄┘ Roots of the equation are: x1 = -3 x2 = -4

More Documents from "Jan Ryan R. Relunia"

Problem 18.docx
April 2020 6
Problem 20.docx
April 2020 8
Prob16 - 20.pptx
April 2020 6
Problem07-10.pptx
April 2020 5
001
August 2019 32
Golicyn_klamstwa
June 2020 19