0% found this document useful (0 votes)
3 views

Assignment-3

mide

Uploaded by

carstaslih
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Assignment-3

mide

Uploaded by

carstaslih
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

OSTIM Techincal University

CENG-109(105) Programming and Computation I

Assignment 2

The Greatest Common Divisor (GCD) of two or more integers, which are not all zero, is the largest positive
integer that divides each of the integers. For two integers x, y, the greatest common divisor of x and y is denoted
by gcd(x,y). For example, the GCD of 8 and 12 is 4, that is, gcd(8, 12) = 4.

The Least Common Multiple of two integers a and b, usually denoted by lcm(x, y), is the smallest positive
integer that is divisible by both x and y. For example, the LCM of 8 and 12 is 24, that is, lcm(8, 12) = 24.

1 – Implement a C function called GCD which computes the GCD of two integers.

2 – Implement a C function called LCM which computes the LCM of two integers.

Then, write a program which uses GCD and LCM functions. It should work as shown in the following figure:

You might also like