Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #include <stdlib.h>
- using namespace std;
- int main()
- {
- int n;//number of numbers
- cin>>n;
- int arr[100];
- srand(time(0));
- for (int i=0; i<n; i++)
- {
- arr[i]=rand()%30-10;
- cout<<i+1<<'.'<<arr[i]<<endl;
- }
- bool flag=false;
- for (int i=0; i<n-1; i++)
- {
- if (arr[i]*arr[i+1]>0)
- {
- flag=true;
- break;
- }
- }
- if (flag==true) cout<<"yes";
- else cout<<"no";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement