Console.WriteLine("Введіть a: ");
int a = Console.ReadLine();
Console.WriteLine("Введіть b: ");
int b = Console.ReadLine();
Console.WriteLine("Введіть c: ");
int c = Console.ReadLine();
Console.WriteLine("Введіть x: ");
int x = Console.ReadLine();
Console.WriteLine("Введіть y: ");
int y = Console.ReadLine();
if(x>y){
int x = temp;
x = y;
y = temp;
}
int sum = 0;
if(a>x && a<y){
sum = sum+a;
}
if(b>x && b<y){
sum = sum+b;
}
if(c>x && c<y){
sum = sum+c;
}
Console.WriteLine("Сума");
Console.WriteLine(sum);
===== С++ 17 =====
#include <iostream>
using namespace std;
void swap(int &a, int &b)
{
int t = a;
a = b;
b = t;
}
int main()
{
int n;
cin >> n;
int a[n];
srand(time(NULL));
for(int i = 0; i < n; i++)
{
a[i] = rand() % 198 - 99;
cout << a[i] << " ";
}
cout << endl;
bool perm = false;
int j;
for(int i = 0; i < n - 1; i++)
{
if(a[i] > a[i + 1])
{
swap(a[i], a[i + 1]);
j = i;
perm = true;
while(perm && (j > 0))
if(a[j] < a[j - 1])
{
perm = true;
swap(a[j], a[j - 1]);
j--;
}
else perm = false;
}
}
for(int i = 0; i < n; i++)
cout << a[i] << " ";
cout << endl;
return 0;
}