1)
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
int num = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(num % 2 == 0 ? "Чётное" : "Нечётное");
Console.WriteLine(num / 10 + num % 10);
}
}
}
2)
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
double[] seconds = new double[8];
string[] athletes = new string[8];
double sum = 0;
double maxN = 0;
int max = 0;
for (int i = 0; i < 8; i++)
{
Console.WriteLine($"Введите фамилию {i + 1}-го участника и его результат: ");
athletes[i] = Console.ReadLine();
seconds[i] = Convert.ToDouble(Console.ReadLine());
sum += seconds[i];
if (seconds[i] > maxN)
{
maxN = seconds[i];
max = i;
}
}
Console.WriteLine($"\n\nСредний результат участников - {sum / 8}");
Console.WriteLine($"Лучший результат у участника с фамилией {athletes[max]} - {maxN}");
}
}
}
1)
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
int num = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(num % 2 == 0 ? "Чётное" : "Нечётное");
Console.WriteLine(num / 10 + num % 10);
}
}
}
2)
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
double[] seconds = new double[8];
string[] athletes = new string[8];
double sum = 0;
double maxN = 0;
int max = 0;
for (int i = 0; i < 8; i++)
{
Console.WriteLine($"Введите фамилию {i + 1}-го участника и его результат: ");
athletes[i] = Console.ReadLine();
seconds[i] = Convert.ToDouble(Console.ReadLine());
sum += seconds[i];
if (seconds[i] > maxN)
{
maxN = seconds[i];
max = i;
}
}
Console.WriteLine($"\n\nСредний результат участников - {sum / 8}");
Console.WriteLine($"Лучший результат у участника с фамилией {athletes[max]} - {maxN}");
}
}
}
n=5;
type
ta=array[1..n] of string;
var ar:ta;i:integer;
path:string;
procedure Save(ar:ta;n:integer;path:string);
var i:integer;
f:text;
begin;
assign(f,path);
rewrite(f);
for i:=1 to n do
writeln(f,ar[i]);
close(f);
end;
begin;
writeln('Введите массив:');
for i:=1 to n do
readln(ar[i]);
writeln('Введите путь к файлу:');
readln(path);
Save(ar,n,path);
end.