class Program { static void Main(string[] args) { int a = 10, b = 5; if (b > 0) { while (b > 0) { a++; b--; } } // when 'b' is negative if (b < 0) { while (b < 0) { a--; b++; } } Console.Write("Sum is: " + a); } }
No comments:
Post a Comment