InterviewBit Academy is now Scaler!
Learn Tech Skills from Scratch @ Scaler EDGE

Trailing Zeroes

Problem Description

Given an integer A, count and return the number of trailing zeroes.

Problem Constraints

1 <= A <= 109

Input Format

First and only argument is an integer A.

Output Format

Return an integer denoting the count of trailing zeroes.

Example Input

Input 1:

 A = 18

Input 2:

 A = 8

Example Output

Output 1:


Output 2:


Example Explanation

Explanation 1:

 18 in binary is represented as: 10010, there is 1 trailing zero.

Explanation 2:

 8 in binary is represented as: 1000, there are 3 trailing zeroes.

NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Trailing Zeroes on Interview Code Editor
  • Hint 1
  • Solution Approach
  • Complete Solution
Asked In:


Click here to start solving coding interview questions