usingMaths.com
Demonstrating and showing pupils and students one application of Mathematics.







<< Previous Next >>

Code for Reducing Fractions to their Lowest Term in Visual Basic (VB.Net)



How to Reduce Fractions to Lowest Term

Reducing fractions to their lowest terms is all about removing every common factor between the numerator and the denominator.


Reducing Fractions to Lowest Term Code in VB.Net

Let's see this using 12/16.

A common factor to 12 and 16 is 2;
so removing 2 from 12/16 yields 6/8.

Again, 2 is common to both 6 and 8;
removing it yields 3/4.

We stop when nothing else is common (1 does not count).

Create a new class file; Project, Add Class.
Call it LowestTerm.vb.
Optionally, create a new module file; Project, Add Module.
Call it LowestTermModule.vb.
Type out the adjoining Visual Basic (VB.Net) codes for reducing fractions to their lowest terms.



Note: You can instead comment out the VB.Net code in the main module from the previous lesson or simply continue from where it stopped.


So!

Feel free to try out your own numerator and denominator.









<< Previous Next >>