How to add a number to int.MaxValue in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.MaxValue + int.Parse("1");

            Console.WriteLine(int.MaxValue);
            Console.WriteLine(n);
        }
    }
}

/*
run:
   
2147483647
-2147483648

*/

 



answered Jan 19, 2017 by avibootz

Related questions

1 answer 197 views
197 views asked Jan 19, 2017 by avibootz
1 answer 126 views
126 views asked Jul 23, 2023 by avibootz
1 answer 117 views
117 views asked Aug 16, 2021 by avibootz
2 answers 270 views
2 answers 182 views
182 views asked Feb 21, 2017 by avibootz
1 answer 221 views
1 answer 84 views
...