Print all integers from 1 to 8 on one line.
| Test | Status | Details |
|---|
Ready — edit the code above and click Run or Submit.
using System;
class Program
{
static void Main()
{
int n = 8;
for (int i = 1; i <= n; i++)
Console.Write(i + (i < n ? " " : ""));
}
}
Try solving on your own first, then reveal the official answer.
Classic warm-up loop.