Skip to content

Instantly share code, notes, and snippets.

@benfb
Created October 28, 2012 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benfb/3969931 to your computer and use it in GitHub Desktop.
Save benfb/3969931 to your computer and use it in GitHub Desktop.
GCDRunner
//import Scanner
import java.util.Scanner; //imports only scanner
public class GCDRunner
{
//main method
public static void main(String[] args)
{
//instantiate Scanner object
Scanner scan = new Scanner(System.in);
//prompt user for numerator
System.out.println("Enter the numerator: ");
//assign user input to variable
int numerator = scan.nextInt();
//prompt user for denominator
System.out.println("Enter the denominator: ");
//assign user input to variable
int denominator = scan.nextInt();
//instantiate GCD object
GCD gcd = new GCD(numerator, denominator);
//call toString() method
System.out.println(gcd.toString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment