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