Answers to ACM platform questions from Shandong University of Technology C language 1181 C language experiment -- Minimum Public multiple and maximum public approx.

Source: Internet
Author: User

C language experiment-least common multiple and maximum Common Divisor Time Limit: 1000 ms Memory limit: 65536 K any questions? Click Here ^_^ Enter two positive integers from the keyboard, calculate the least common multiple and the maximum common number of the two positive integers, and output them. The input includes one row.
Two positive integers separated by spaces. Returns the least common multiple and the maximum common number of two integers. Sample Input
6 8
Sample output
24 2
 
# Include
Void main ()
{
Int p, r, m, n, s;
Scanf ("% d", & n, & m );
If (n {
S = n;
N = m;
M = s;
}
P = m * n;
While (m! = 0)
{
R = n % m;
N = m;
M = r;
}
Printf ("% d \ n", p/n, n );
}

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.