Skip to content
Vašek edited this page Feb 7, 2019 · 3 revisions

gcd

This function returns the greatest common divisor of the given numbers

Syntax:

gcd(n, x)
Argument Description
int n First number
int x The other number

Returns: int

Description:

The greatest common divisor of two numbers is the largest positive integer that divides each of the integers. For example: What is the greatest common divisor of 72 and 24?

Divisors of 72 are:

Divisors of 24 are:

Their greatest common divisor is 24.

Example:

int value = gcd(54, 24);

This function sets value to 6.

Back to number_functions

Clone this wiki locally