1028:c Language Programming Tutorial (third Edition) after class exercise 8.1 using functions to find the number of conventions

Source: Internet
Author: User
Tags greatest common divisor

The title description writes two functions, each for two integers greatest common divisor and least common multiple, calls these two functions with the main function, and outputs the result two integers by the keyboard input. Input two-digit output greatest common divisor least common multiple sample input
6 15
Sample output
3 30
Hint Source

int main() { int a,m,n,cun,bei; scanf ( "%d %d" ,&m,&n); a=m*n; if (m<n)cun=m,m=n,n=cun; while (n!=0) {      cun=m%n;      m=n;      n=cun; } bei=a/m; printf ( "%d %d" ,m,bei); return 0; }

1028:c Language Programming Tutorial (third Edition) after class exercise 8.1 using functions to find the number of conventions

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.