Предмет: Информатика, автор: Hunters1538

Напишите программу на с# или на с++

Приложения:

Aillianna: static void Main()
{
//using (var sw = File.CreateText("input.txt"))
//{
// sw.Write($"{new Random().Next(-100, 100)}");
// sw.Close();
//}

var n = int.Parse(File.ReadAllText("input.txt").Trim());
using (var sw = File.CreateText("output.txt"))
{
sw.WriteLine($"The next number for {n} is {n+1}");
sw.WriteLine($"The previous number for {n} is {n-1}");
sw.Close();
}
}

Ответы

Автор ответа: ruslol
0
static void Main(string[] args)       
{           
String file = File.ReadAllText("input.txt");           
int s = Int32.Parse(file);           
int next = s + 1;           
int previous = s - 1;           
String outputString = String.Format("The next number for {0} is {1}.\r\nThe previous number for {0} is {2}.\r\n",s,next,previous);            File.WriteAllText("output.txt",outputString);       
 }
Похожие вопросы
Предмет: Математика, автор: LittleHermion