Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q4. Design an algorithm and write its C++ code. It takes two integer arguments, call them, begin and end, and returns as its value the

image text in transcribedimage text in transcribedimage text in transcribed

Q4. Design an algorithm and write its C++ code. It takes two integer arguments, call them, "begin" and "end", and returns as its value the sum of all the integers between begin and end inclusive. Thus, for example: begin=-3 & end=1 will print--5 because (-3)+(-2)+(-1)+0+1 = -5 Keep your code commented and indented for ease of reading. Paste your commented codes in the solution and also add a clear screen shot of outcome in your solution: (3.0-Mark) Soln.: Q5. Design an algorithm and write its C++ code based on Switch-Case statements. It takes an integer argument in the range from t to 9, inclusive, and prints the English name for that integer on the computer screen. If the argument is not in the required range, then the function should print "Out of Range Digit" without the quotation. Thus, for example: The '7' should be printed as 'seven' on the screen; Keep your code commented and indented for ease of reading. Paste your commented codes in the solution and also add a clear screen shot of outcome in your solution: (3.0-Mark) Q6. Design an algorithm and write its C++ code. It takes two positive integer arguments, call them,"m" and "n", 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 valuen (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, ifm' and 'n' have been declared to be integer variables in a program, then. Thus, for example: m = 63; n = 210; will produce and print 3/10' m = 25; n = 0; will produce and print Fractional Error' Keep your code commented and indented for ease of reading. Paste your commented codes in the solution and also add a clear screen shot of outcome in your solution: (3.0-Mark)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

2. define diversity, inclusion, and cultural competence;

Answered: 1 week ago

Question

a. Did you express your anger verbally? Physically?

Answered: 1 week ago