Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 18 additions & 1 deletion src/MyMath.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
import java.util.Scanner;

/**
* @author Olivia McKittrick
* @date 10/31/23
*
*/
public class MyMath {

public static int gcf(int a, int b) { // the two numbers
while (b != 0) { // while statement that continues as long as b is not = 0
int temp = b; // temporarily stores b in temp to keep the original b value
b = a % b; // updates the value of b
a = temp; // updates value of a with value of b stored in temp
}
return a;
}
public static void main(String[] args) {
int num1 = 1112;
int num2 = 695;

int result = gcf(num1, num2);
System.out.println("The GCF of " + num1 + " and " + num2 + " is " + result);
}
}