Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

with jave please Reduce the Fraction You are given a fraction in the form X/Y where X and Y are two integers. Your task is

with jave please

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Reduce the Fraction You are given a fraction in the form X/Y where X and Y are two integers. Your task is to reduce it to its lowest lrreducible state: XY. For example, 4/6 should be reduced to 2/3, 20/10 should be reduced to 2/1, 160/28 should be reduced to 40/7 and so on. Complete the ReduceFraction function in your editor. It has 1 parameter: 1. A string array fractions t must return a string array, where ith element is result for the ith test case. Input Format The locked stub code in your editor reads the following input from stdin and passes it to your function: The first line contains an integer n Next n nes contains a string in each line containing a fraction provided in the form X y, where ne denotes ith test case Constraints 1 s X Y s 2000 1 s N s 500 Output Format array, where it denotes result for the ith case. This Your function must return a string test is printed to t by the locked stub code in your editor

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

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions

Question

Discuss the key ambient conditions and their effects on customers.

Answered: 1 week ago

Question

Understand the roles of signs, symbols, and artifacts.

Answered: 1 week ago