Minimum count of digits required to obtain given Sum | C # program to implement the above approach ; Function to print the minimum count of digits ; IF N is divisible by 9 ; Count of 9 's is the answer ; If remainder is non - zero ; Driver Code
using System ; class GFG { static void mindigits ( int n ) { if ( n % 9 == 0 ) { Console . WriteLine ( n / 9 ) ; } else { Console . WriteLine ( ( n / 9 ) + 1 ) ; } } public static void Main ( String [ ] args ) { int n1 = 24 ; int n2 = 18 ; mindigits ( n1 ) ; mindigits ( n2 ) ; } }