CountDiv

PHOTO EMBED

Tue Jun 21 2022 22:04:51 GMT+0000 (Coordinated Universal Time)

Saved by @jacobsfo

int solution(int A, int B, int K) {
    // write your code in C++14 (g++ 6.2.0)
    //0 to b - 0 to a => a to b
    int c = (B/K)-(A/K);
    //check if divisible
    if(A%K==0)
    {
        c++;
    }
    return c;
}
content_copyCOPY