Бауыржан, делятся на что, на 2, на 3, на введенное с клавиатуры и что с этими числами сделать?
Ввод с клавиатуры делителя и вывод на экран нужных шести чисел:
C++ |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| #include <iostream>
#include <iomanip>
#include <cstdio>
#include <ctime>
void fillingSearch(int [], int , int );
const int SIZE = 10;
int main()
{
int arr[SIZE];
int num;
cin >> num;
fillingSearch(arr, SIZE, num);
}
void fillingSearch(int a[], int size, int del)
{
int r = 0;
for (int i = 0; i < size; i++)
a[i] = 1 + rand() % 10;
for (int i = 0; i < size; i++)
{
if (a[i] % del == 0)
{
cout << a[i] << setw(5);
r++;
}
if (r == 6)
break;
}
} |
|