#C2:
#include
#include
using namespace std;
#define _ABS(a) ((a) < 0 ? (-a) : (a))
/* Main program function.
* ARGUMENTS: None.
* RETURNS:
* (int) error level for operation system.
*/
int main()
{
srand(time(NULL));
const int numOfEl = 10;
int mainArray[numOfEl],
minDelta = 2001,
delta;
for (int i = 0; i < numOfEl; i++)
{
mainArray[i] = rand() % 2000 - 1000;
cout << mainArray[i] << "; ";<br> }
for (int i = 1; i < numOfEl; i++)
{
delta = _ABS(mainArray[i - 1] - mainArray[i]);
if (delta < minDelta && delta % 15 == 0)
minDelta = delta;
}
cout << endl;<br> if (minDelta == 2001)
cout << "Не найдено." << endl;<br> else
cout << minDelta << endl;<br>
system("pause");
return 0;
} /* End of the 'main' function */