Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- pair <int, int> find(int n, int *a){
- pair <int, int> x;
- x.first = -1;
- x.second = -1;
- for(int i = 0; i < n; ++i)
- if(a[i] == 0)
- if(x.first == -1) x.first = i;
- else{
- x.second = i;
- return x;
- }
- return x;
- }
- int main()
- {
- int *a = new int [10];
- int n,k,i,j,pr=1,iCount = 0;
- pair <int, int> x;
- cout<<"vvedite razmer massiva:";
- cin>>n;
- cout<<"vvedite massiv ";
- for(i=0;i<n;i++)
- cin>>a[i];
- x = find(n, a);
- if (x.first == -1 || x.second == -1)
- cout << "There are no two zero\n";
- else{
- for(i = x.first+1; i < x.second; ++i)
- pr *= a[i];
- cout << pr;}
- return 0;
- }
Add Comment
Please, Sign In to add comment