#include <iostream>
using namespace std;
void chysla()
{
int a;
char b;
cout << "Введите 1 цифру" << endl;
cin >> a;
while (a < 100)
{
++a;
cout << a << "\n";
}
if (a == 100)
{
cout << "Конец цикла" << endl;
}
cout << "Закончить процессы? Y/N" << endl;
cin >> b;
if (b == 'Y')
{
cout << "Закройте программу" << endl;
}
else if (b == 'N')
{
cout << "Ведите 1 цифру" << endl;
cin >> a;
}
while (a < 100)
{
++a;
cout << a << "\n";
}
}
int main()
{
setlocale(LC_ALL, "rus");
chysla();
return 0;
}
import java.util.Arrays;
public class ArrayHandler {
static double[] handle(double[] array) {
double sum1 = 0.0;
for(int i = 1; i < array.length; i+=2)
sum1 += array[i];
System.out.println(sum1);
double sum2 = 0.0;
int negPos1 = -1, negPos2 = -1;
for(int i = 0; i < array.length; i++)
if(array[i] < 0)
if(negPos1 == -1)
negPos1 = i;
else
negPos2 = i;
if(negPos2 != -1)
for(int i = negPos1 + 1; i < negPos2; i++)
sum2 += array[i];
System.out.println(sum2);
int iter = 0;
double[] temp = new double[array.length];
for(double v : array)
if(v > 1 || v < -1)
temp[iter++] = v;
double[] result = new double[iter];
System.arraycopy(temp, 0, result, 0, iter);
return result;
}
}