This is my attempt at the Euclid Algorithm. I would like it if someone could give me some pointers on how to fix this so that it would work. It compiles fine.

import java.util.Scanner;
public class Euclid{
	public static void main(String[] args){
		Scanner scanner = new Scanner(;
		System.out.print("Enter the first number: ");
		int n = scanner.nextInt();
		System.out.print("Enter the second number: ");
		int m = scanner.nextInt();
		int remain=m%n;
		int remain2=n%remain;
		System.out.print("The GCF is: "+ remain);

gotta be honest im not finding anything wrong with it? can you give me two numbers that would cause something to go wrong?

I tested 25 and 4.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.