Minimum number of cuts required to pay salary from N length Gold Bar | C # Implementation to find the minimum number of cuts to pay the worker . ; Function to find the minimum number of cuts to pay the worker . ; Nearest int to the Log value of the number N ; Driver code ; Cuts Required in the Length of 15
using System ; class GFG { static int pay ( int n ) { int cuts = ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) ; return cuts ; } public static void Main ( String [ ] args ) { int n = 5 ; int cuts = pay ( n ) ; Console . Write ( cuts + " STRNEWLINE " ) ; n = 15 ; cuts = pay ( n ) ; Console . Write ( cuts ) ; } }