(C syntax) Minimum Public multiple, c syntax 24 minimum public multiple

Source: Internet
Author: User

(C syntax) Minimum Public multiple, c syntax 24 minimum public multiple

Knowledge point:

Algorithm

While loop usage.

 

Content: returns the minimum public multiple of two natural numbers.

Input description:

Output description:

 

Input example:

2 4

Output example:

4

 

1 # include <stdio. h> 2 int main () 3 {4 int a, B, t, A, B; 5 scanf ("% d", & a, & B ); 6 A = a; 7 B = B; 8 do 9 {10 t = a % B; 11 a = B; 12 B = t; 13} 14 while (t! = 0); 15 printf ("% d \ n", A * B/a); 16 return 0; 17}

 


The minimum public multiples of A, B, and C are 24, the minimum public multiples of B and C are 40, and the minimum public multiples of A and C are 30, which is A, B, and C?

A = 3, B = 8; C = 10
If the minimum public multiples of A and B are 24, the following possibilities may be [, X], [24, 1, X], [, X], [, X]
The minimum public multiples of B and C are 40. Combined with the above analysis, it is possible to [24, 1, 40], [3, 8, 5], [3, 8, 10], [3, 8, 20], [3, 8, 40]
If the minimum public multiple of A and C is 30, The result [, 10] is obtained based on the previous analysis]

The maximum public factor of two numbers is 4 and the minimum public factor is 24. The two numbers cannot be () A4 and 24 B8 and 12 c8 and 24

C
The maximum public factor of C is 8.

Wish you progress \ (^ o ^ )/~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.