Dashboard Temp Share Shortlinks Frames API

HTMLify

Q2427_Number_of_Common_Factors.rs
Views: 521 | Author: djdj
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
impl Solution {
    pub fn common_factors(a: i32, b: i32) -> i32 {
        let mut c=0;
        for i in 1..a+b{
            if(a%i==0 && b%i==0){
                c=c+1;
            }
        }
        return c;
    }
}