Work on MP3
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package mp3_calebfontenot;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author caleb
|
||||
*/
|
||||
public class GCDDoWhile {
|
||||
|
||||
public static void main(String[] args) {
|
||||
java.util.Scanner input = new java.util.Scanner(System.in);
|
||||
System.out.print("Enter the first number: ");
|
||||
int n1 = input.nextInt();
|
||||
System.out.print("Enter the second number: ");
|
||||
int n2 = input.nextInt();
|
||||
|
||||
int d = (n1 < n2) ? n1 : n2;
|
||||
do {
|
||||
if ((n1 % d == 0) && (n2 % d == 0)) {
|
||||
break;
|
||||
}
|
||||
d--;
|
||||
} while (d >= 1);
|
||||
System.out.println("GCD of " + n1 + " and " + n2 + " is " + d);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user