class Program { static void Main() { string fileName = "numbers.txt"; using (StreamWriter writer = new StreamWriter(fileName)) { for (int i = 1; i <= 100; i++) { writer.Write(i); if (i < 100) { writer.Write(","); } } }
Console.WriteLine("Numbers from 1 to 100 have been written to numbers.txt"); }
using System;
using System.IO;
class Program
Console.WriteLine("Numbers from 1 to 100 have been written to numbers.txt");{
static void Main()
{
string fileName = "numbers.txt";
using (StreamWriter writer = new StreamWriter(fileName))
{
for (int i = 1; i <= 100; i++)
{
writer.Write(i);
if (i < 100)
{
writer.Write(",");
}
}
}
}
}