text: Count of Octal numbers upto N digits | C # program to find the count of natural octal numbers upto N digits ; Function to return the count of natural octal numbers upto N digits ; Loop to iterate from 1 to N and calculating number of octal numbers for every ' i ' th digit . ; Driver code
code: using System ; class GFG { static int count ( int N ) { int sum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { sum += ( int ) ( 7 * Math . Pow ( 8 , i - 1 ) ) ; } return sum ; } public static void Main ( ) { int N = 4 ; Console . WriteLine ( count ( N ) ) ; } }