Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/MyMath.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
/**
*
* @author Trevor Hartman
* @author Cassandra Portlock
*
* @since Version 1
*
*/

import java.util.Scanner;

public class MyMath {
private final static Scanner s = new Scanner(System.in);
public static void gcf() {
System.out.print("Type first number to find greatest common factor: ");
int a = s.nextInt();

System.out.print("Type first number to find greatest common factor: ");
int b = s.nextInt();

while (b != 0) {
int c = a;
a = b;
b = c % b;
}

System.out.printf("The Greatest Common Factor is: %s", a);
}

public static void main(String[] args) {
gcf();
}
}