Learn R Programming

phonTools (version 0.2-2.2)

reduce.fraction: Reduce Fractions

Description

Reduce fractions to lowest terms using Euclid's Algorithm.

Usage

reduce.fraction (ratio)

Value

A vector containing the elements of the reduced fraction. The first element is the numerator of a ratio, and the second element is the denominator.

Arguments

ratio

A vector with two integers. The first element is the numerator of a ratio, and the second element is the denominator.

Author

Santiago Barreda <sbarreda@ucdavis.edu>

Examples

Run this code
## an easy one
reduce.fraction (c(100, 200))

## irreducible
reduce.fraction (c(140, 201))

## a hard one
reduce.fraction (c(140, 203))

Run the code above in your browser using DataLab