Write function named reduce that takes two positive integer

Assignment Help Computer Engineering
Reference no: EM131914178

Assignment

Write a function named "reduce" that takes two positive integer arguments, call them "num" and "denom", treats them as the numerator and denominator of a fraction, and reduces the fraction. That is to say, each of the two arguments will be modified by dividing it by the greatest common divisor of the two integers. The function should return the value 0 (to indicate failure to reduce) if either of the two arguments is zero or negative, and should return the value 1 otherwise. Thus, for example, if m and n have been declared to be integer variables in a program, then
m = 25; n = 15;
if (reduce(m,n))
cout
5/3

Note that the values of m and n were modified by the function call. Similarly, m = 63; n = 210; if (reduce (m,n))
cout
cout
3/10
Here is another example.
m = 25; n = 0;
if (reduce(m,n))
cout

The function reduce is allowed to make calls to other functions that you have written.

Reference no: EM131914178

Questions Cloud

Appropriate confidence interval : Conduct the test in (a) using an appropriate confidence interval.
Plies trade between ghana and south africa : Miss Rebecca Naa started business in January 2015 with initial capital of GHS 40,000 from her daily “susu”. She plies her trade between Ghana and South Africa.
Prepare a written response to the given question : Please prepare a written response to the following question and then select six (6) additional questions from those which follow and prepare your response.
Distributions of the same shape : Assume that both samples are from distributions of the same shape. Is there sufficient evidence to indicate that the median amount of DDT
Write function named reduce that takes two positive integer : Write a function named reduce that takes two positive integer arguments, call them num and denom, treats them as the numerator.
Newborns between the two ethnic groups : Estimate the mean difference in heart rate for newborns between the two ethnic groups using a 95% confidence interval.
Write the same standardized entrance exam : Two universities (A and B) require first year applicants to write the same standardized entrance exam.
What is the probability that less than three-fourths : In random sample of 300 elementary school teachers. What is the probability that less than three-fourths are women.
List all possible outcomes for who : List all possible outcomes for who will get a part in the play in the following table. Two outcomes have been filled in for you (there are many more.)

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd