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

  Write a simple computer program to evaluate a function

CS 109 - C/C ++ Programming for Engineers w. MatLab- Spring 2016 Assignment. For this assignment you are to write a simple computer program to evaluate a function of 2 variables over a range of input values, using one- and two-dimensional arrays.  ..

  Find growth of cloud computing

There are others that are considering moving most of their IT operations to an applications management service provider that does not use the cloud.

  Why it is necessary to use database system

Why it is necessary to use database system? What kinds of information this database system collect? and what information it provides?

  Identify the positive and negative aspects of the website

COIS 12036 Human Computer Interaction Provide an overview and description of the nominated website and identify and elaborate the main feature or features of the website.

  Draw the final binary search tree

Read the author's question above, and examine the following write-up to answer this question: is it true as stated; if not, why not?

  Write the polynomial method equals-difference

Write the Polynomial method equals_difference and integrate it into the calculator. Calculates a Polynomial object by multiplying p by the single Term t.

  Write a method called reverse that accepts string parameter

Write a Boolean method called startT that accepts a String parameter and returns true if the string starts with "T", otherwise returns false.

  What is an example of a human expert system

What is an example of a human expert system? Define some variables and some rules that might be in an expert system for automobile repair.

  What ordering results in an optimal tree

Inserting the values in different orders results in different shapes of trees. What ordering results in an optimal (complete) tree? Show the resulting tree.

  Questionusing matlabdescribes a function named insidecircle

questionusing matlabdescribes a function named insidecircle that takes 3 arguments as input- the center of the circle

  How to create a web page called index.html

Can you please help me with frames. I am using dreamweaver, and have been trying to design frames. However, I noticed that what happens is say I create a web page called index.html with frames in it, every time I open the index.html for editing it..

  Write r functions for forecasting future values

you will write R functions for forecasting future values of a time series, and apply them to observations on numbers of deaths and maximum temperatures in Houston, Texas.

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