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 191 views
191 views asked Jan 19, 2017 by avibootz
1 answer 116 views
116 views asked Jul 23, 2023 by avibootz
1 answer 110 views
110 views asked Aug 16, 2021 by avibootz
2 answers 257 views
2 answers 177 views
177 views asked Feb 21, 2017 by avibootz
1 answer 211 views
1 answer 73 views
...