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

How to Share webservice object to all user

How to fix error Msg 1801, Level 16, State 3, Line 1