ответ:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include
#include
using namespace std;
int main(int argc, char** argv) {
int num, n, co;
cout< < "number? "<
cin> > num;
cout< < "cifra? "<
cin> > n;
int count = 0;
for (; num> 0; count++) {
num /= 10;
}
for (int i = 0; i < count; i++) {
if (num[i] == n) {
co++;
}
}
cout< < "number of "<
return 0;
}
объяснение:
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}");
}
}
}
a: array[1..1000] of integer;
sa: real;
i: byte;
begin
writeln ('Введите числа: ');
i:=0;
sa:=0;
repeat
i:=i+1;
read (a[i]);
sa:=sa+a[i];
until a[i]=0;
sa:=sa/(i-1);
writeln ('Среднее арифметическое чисел = ',sa);
end.
Пример:
Введите числа:
2 4 2 4 2 4 0
Среднее арифметическое чисел = 3