уточнять на каком языке программирования нужно написать задачки. Я же напишу на С++. Алгоритм везде будет один и тот же.
1 задача
int x1 = 0;
int x2 = 0;
int x3 = 0;
int x4 = 0;
int x5 = 0;
cin >> x1;
cin >> x2;
cin >> x3;
cin >> x4;
cin >> x5;
double sr = 0.0;
sr = (x1+x2+x3+x4+x5)/5;
Или же можно сделать по проще
int x = 0;
int sum = 0;
double sr = 0.0;
for(int i = 0; i<5; i++){
cin >> x;
sum = sum +x;
}
sr = sum/5;
2 Задача
int number = 5;
for(int i = 2; i<20; i=i+2){
number = number + i;
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cool{
class main
{
static void Main(string[] args)
{
int u1 = 1, u2 = 2;
int l1 = 1, l2 = 1;
double a = 0, eps = 0.001;
int i = 2;
int U, L;
double A;
U = u2 + u1;
L = l2 + l1;
A = (double)U / L;
while (Math.Abs(A - a) > eps || i < 5)
{
a = A;
i++;
l1 = l2; u1 = u2;
l2 = L; u2 = U;
U = u2 + l2;
L = l2 + l1;
A = (double)U / L;
#if DEBUG
Console.WriteLine("{0} -> {1}|{2}", i, U, L);
#endif
if (i == 5)
Console.WriteLine("Пятый элемент: {0}", A);
if (Math.Abs(A - a) < eps)
Console.WriteLine("Элемент, отличающийся на менее чем {1}: {0}", A, eps);
}
}
}
}