Using System;
namespace chislaabc
{
class Program
{
static void Main(string[] args)
{
int a, b, c;
Console.WriteLine(“Введите число a”);
a = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(“Введите число b”);
b = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(“Введите число c”);
c = Convert.ToInt32(Console.ReadLine());
if (a == b || a == c || b == c)
{
Console.WriteLine(«Есть хотя бы одна противоположная пара»);
}
else
{
Console.WriteLine(«Противоположных чисел нет»);
}
Console.ReadKey();
}
}
}
ответ:
объяснение:
если я все правильно понял:
#include "pch.h"
#include
using namespace std;
int main()
{
setlocale(null, "rus");
double a[100];
int n;
cout < < "введи количество элементов массива: "; cin > > n;
cout < < "введи элементы массива: " < < endl;
for (int i = 0; i < n; i++)
cin > > a[i];
double s = 0;
int fznach, sznach;
for (int i = 0; i < n; i++)
{
if (a[i] == 0)
sznach = i;
}
for (int i = n-1; i > = 0; i--)
{
if (a[i] == 0)
fznach = i;
}
for (int i = fznach; i < sznach; i++)
s = s + a[i];
cout < < " искомая сумма равна: " < < s < < endl;
return 0;
}