Smallest and Largest sum of two n | C # implementation of the approach ; Function to return the smallest sum of 2 n - digit numbers ; Function to return the largest sum of 2 n - digit numbers ; Driver code
using System ; class GFG { static int smallestSum ( int n ) { if ( n == 1 ) return 0 ; return ( 2 * ( int ) Math . Pow ( 10 , n - 1 ) ) ; } static int largestSum ( int n ) { return ( 2 * ( ( int ) Math . Pow ( 10 , n ) - 1 ) ) ; } public static void Main ( ) { int n = 4 ; Console . WriteLine ( " Largest ▁ = ▁ " + largestSum ( n ) ) ; Console . Write ( " Smallest ▁ = ▁ " + smallestSum ( n ) ) ; } }