Count the minimum steps to reach 0 from the given integer N | C ++ program to Count the minimum steps to reach 0 from the given integer N ; Function returns min step to reach 0 from N ; Direct possible reduction of value N ; Remaining steps needs to be reduced by 1 ; Summation of both the values ; Return the final answer ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int getMinSteps ( int n , int jump ) { int quotient = n / jump ; int remainder = n % jump ; int steps = quotient + remainder ; return steps ; } int main ( ) { int N = 6 , K = 3 ; cout << getMinSteps ( N , K ) ; return 0 ; }