Calculate the maximum common divisor and least common multiple of two numbers.
If a natural number A can be divisible by natural number B, A is called a multiple of B, and B is the approximate number of. The common divisor of several natural numbers is called the common divisor of these natural numbers.
The largest common divisor of a common divisor is the maximum common divisor of these natural numbers.
The common multiples of several numbers are called the Public multiples of these numbers. The smallest public multiple is called the minimum public multiples of these numbers.
Formula for calculating the maximum common approx.: F (x, y) = f (y, X % Y) (Y> 0)
Formula for least common multiples: least common multiples = product of two numbers/Maximum number of conventions (reason)
Package WZS. arithmetics; // calculate the maximum common number and the minimum common number of two numbers. // If a natural number A can be divisible by natural number B, it is called a as a multiple of B and B as an appointment number of. The common divisor of several natural numbers is called the common divisor of these natural numbers. // The largest common divisor of a common number is called the maximum common divisor of these natural numbers. // The common multiples of several numbers are called the Public multiples of these numbers. The smallest public multiple is called the least public multiples of these numbers. // F (x, y) = f (y, X % Y) (Y> 0) maximum common divisor // minimum common multiple = product of two numbers/maximum Convention (reason) public class test_wzs6 {public static void main (string [] ARGs) {int x = 28; int y = 12; system. out. println ("maximum common Appointment:" + test_wzs6.f (x, y); system. out. println ("minimum public multiple:" + x * Y/test_wzs6.f (x, y ));} /*** calculate the maximum common divisor * @ Param x * @ Param y * @ return */public static int F (int x, int y) {If (x <0 | Y <0) {system. out. println ("incorrect input. "); Return-1;} If (y = 0) {// system. out. println ("maximum common Appointment:" + x); Return X;} return f (y, X % Y );}}