Язык Java
import java.util.*;
import java.io.*;
public class Main {
static int _16yearsOld = 0;
static int min = 14;
static int max = 16;
static int diff = max - min;
static Random random = new Random();
static int rand = random.nextInt(diff + 1);
rand += min;
public static void main(string[] args) {
int[] students = new int[19];
for (int i = 0; i <= students.size(); i++) {
students[i] = rand;
}
if (students[i] == 16)
_16yearsOld++;
Язык Java
import java.util.*;
import java.io.*;
public class Main {
static int _16yearsOld = 0;
static int min = 14;
static int max = 16;
static int diff = max - min;
static Random random = new Random();
static int rand = random.nextInt(diff + 1);
rand += min;
public static void main(string[] args) {
int[] students = new int[19];
for (int i = 0; i <= students.size(); i++) {
students[i] = rand;
}
for (int i = 0; i <= students.size(); i++) {
if (students[i] == 16)
_16yearsOld++;
}
}
}
#include <conio.h>
#include <time.h>
using namespace std;
void main()
{
srand(time(NULL));
setlocale(0, "");
int arr[17];
int a, b, chet=0, nechet = 0;
cout << "Введите диапазон ." << endl << "Нижняя граница диапазона: "; cin >> a; cout << "Верхняя граница диапазона: "; cin >> b; cout << endl;
for (int i = 0; i < 17; ++i)
{
arr[i] = a + rand() % (b-a+1);
cout <<" "<<arr[i];
}
for (int i = 0; i < 17; ++i)
{
if (arr[i] % 2 == 0) chet++;
else nechet++;
} if (chet > nechet)
cout << " \n Четных больше";
else if (nechet>chet)
cout << "\n Нечетных больше";
else cout << "\n Одинаковое количество четных и нечетных";
_getch();
}