GCD function for C

前端 未结 4 1850
礼貌的吻别
礼貌的吻别 2021-02-15 18:04

Q 1. Problem 5 (evenly divisible) I tried the brute force method but it took time, so I referred few sites and found this code:

#include
int gcd(i         


        
4条回答
  •  天涯浪人
    2021-02-15 18:40

    Using a bit of recursion and Objective-C

    -(int)euclid:(int)numA numB:(int)numB
    {
        if (numB == 0)
            return numA;
        else
            return ([self euclid:numB numB:numA % numB]);
    }
    

提交回复
热议问题