+ 1

An integer randomly turns negative

The code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int n = 100; int num1 = 1; int num2 = 1; int num3 = num1 + num2; //2 int A = 0; while (A < n-3) { num3 += num2; //3 num2 = num3 - num2;//2 A++; //test Console.WriteLine("num2: "+ num2); //test Console.WriteLine("num3: "+ num3); //test Console.WriteLine(""); } } } } after 44 times that the loop is executed the num3 integer just turns negative....

8th Sep 2021, 6:04 PM
Krispy
Krispy - avatar
2 Respuestas
0
And your doubt ?
8th Sep 2021, 7:55 PM
Hima
Hima - avatar