← C# from Scratch
Lesson 17 of 39 · 5 XP
Warm-up: from 1 to n warm-up
Theory and problem statement
Machine translation, not yet reviewed by a native speaker.
A for has three parts: start, condition and step. The loop below prints 1, 2, 3:
for (int i = 1; i <= 3; i++)
{
Console.WriteLine(i);
}
Task. Read n and print the numbers from 1 to n, each on its own line.
Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.