Find the frequence of digit 5 in the octal representation of the given decimal number N.
The digits in the octal representation can be easily obtained by continously dividing by 8 and finding the remainder till N becomes Zero. Remainder in each iteration represents a digit in octal representation.
Use a count variable to count the number of times the remainder is 5
can be found here