Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- const int n = 5;
- int X;
- int c=0;
- int A[n];
- srand(time(0));
- for (int i = 0; i < n; i++) {
- A[i] = rand() % 6;
- cout << A[i] << " ";
- }
- cout << endl;
- cin >> X ;
- for (int i = 0; i < n; i++) {
- if (X == A[i]) {
- cout << "A[" << i << "]=" << X << endl;
- c += 1;
- }
- }
- if (c == 0) {
- cout << "no";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement