import java.util.Scanner; public class GCDProgram3 { public static void main(String[] args) { int length, width; System.out.print("Enter the floor length (cm): "); length = new Scanner(System.in).nextInt(); System.out.print("Enter the floor width (cm): "); width = new Scanner(System.in).nextInt(); while ((length > 0) && (width > 0)){ System.out.println(length + " " + width); if (length > width) length = length%width; else width = width%length; } if (length > 0) System.out.println("You need (" +length+ "cm x " +length+ "cm) tiles."); else System.out.println("You need (" +width+ "cm x " +width+ "cm) tiles."); } }