euclid algorithm
unsigned int euclid_algorithm(unsigned int a, unsigned int b) {
while (b != 0) {
unsigned int temp = b;
b = a % b;
a = temp;
}
return a;
}
Step 1: Start the while loop, checking if b is not equal to 0.
Step 2: Set temp equal to b.
Step 3: Set b equal to the remainder of a divided by b.
Step 4: Set a equal to temp.
Step 5: Repeat the process until b equals 0.
Step 6: Return the value of a as the greatest common divisor.