// Arup Guha
// 4/29/2022
// Solution to Spring 2022 COP 3502 Final Exam Question 5

#include <stdio.h>

int getLevel(int skillMask);

int main(void) {

    // Some tests.
    printf("%d\n", getLevel(111));
    printf("%d\n", getLevel(126));
    printf("%d\n", getLevel(63));

    return 0;
}

// Returns the level of the blackbelt who's skills are stored in skillMask.
int getLevel(int skillMask) {

    int i = 0;

    // Just looking for the first bit that is off.
    while ( (skillMask & (1<<i)) != 0)
        i++;

    // This is it.
    return i;
}
