CJCoding With Joseph
← Back to Question List
C# Code Walkthrough #6

For Loop Sum 1 to 5

easyLoops

📄 Code

Read carefully — what does this print?
1int sum = 0;
2for (int i = 1; i <= 5; i++)
3{
4 sum += i;
5}
6Console.WriteLine(sum);

🎯 Your Answer