Any one liner code ?


   public static void main()
        {
            //looking better code below problem
            //the house numbers along jefferson street 1 through 120.
            //how many digits there house numbers..
            int digitcount = 0;
            (int = 1; <= 120; i++) digitcount += i.tostring().length;
            console.writeline(digitcount);
        }

you use:

int digitcount = enumerable.range(1, 120).sum(i => i.tostring().length);



reed copsey, jr. - http://reedcopsey.com
if post answers question, please click "mark answer" on post , "mark helpful".




Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'