#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int sum=0,n,count=1, count_ch=0;
float result;
cin >> n;
if (n<10000)
while (n != 0)
if (n % 2 == 0)
sum += n;
count_ch++;
}
count++;
if (n > 10000 or count > 1000)
break;
result = sum/count_ch;
printf("%.2f",result);
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int sum=0,n,count=1, count_ch=0;
float result;
cin >> n;
if (n<10000)
{
while (n != 0)
{
if (n % 2 == 0)
{
sum += n;
count_ch++;
}
cin >> n;
count++;
if (n > 10000 or count > 1000)
{
break;
}
}
}
result = sum/count_ch;
printf("%.2f",result);
}
using namespace std;
int main()
{
int s, i;
cout << "s = ";
cin >> s;
double a[s], m1, m2;
int m1i, m2i, f, t;
/* Заполнение */
for (i = 0; i < s; i++)
{
cout << i << ':';
cin >> a[i];
}
/* Первый максимум */
m1i = 0;
m1 = a[m1i];
for (i = 1; i < s; i++)
{
if (a[i] > m1)
{
m1 = a[i];
m1i = i;
}
}
/* Второй максимум */
m2i = 0;
m2 = a[m2i];
for (i = 1; i < s; i++)
{
if (i == m1i) continue;
if (a[i] > m2)
{
m2 = a[i];
m2i = i;
}
}
/* Порядок итерации */
if (m1 > m2)
{
f = m2i;
t = m1i;
}
else
{
f = m1i;
t = m2i;
}
for (i = f + 1; i < t; i++)
{
a[i] = 0;
}
for (i = 0; i < s; i++)
{
cout << a[i] << ' ';
}
return 0;
}