T Trần Vũ New member Sep 18, 2021 #1 What will be the output of the following C# code? Code: static void Main(string[] args) { float f; for (f = 0.1f; f <= 0.5; f += 1) Console.WriteLine( ++f ); Console.ReadLine(); } A. Code: 1.1 B. 0.1 C. 0.1 0.2 0.3 0.4 0.5 D. None of the mentioned
What will be the output of the following C# code? Code: static void Main(string[] args) { float f; for (f = 0.1f; f <= 0.5; f += 1) Console.WriteLine( ++f ); Console.ReadLine(); } A. Code: 1.1 B. 0.1 C. 0.1 0.2 0.3 0.4 0.5 D. None of the mentioned
D Dương Mạnh Cường New member Sep 18, 2021 #2 Answer: a Explanation: f = 0.1 and ++f = 0.1+1 = Code: 1.1 . So, Code: 1.1 >0.5, Condition fails and hence loop terminates. Output : Code: 1.1 Upvote 0 Downvote
Answer: a Explanation: f = 0.1 and ++f = 0.1+1 = Code: 1.1 . So, Code: 1.1 >0.5, Condition fails and hence loop terminates. Output : Code: 1.1