Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main()
- {
- int b(-1);
- while(b<0)
- {
- cout<<"vuvedete razmer na masiva:"<<endl;
- cin>>b;
- if(b>40)
- b=-1;
- }
- int i = 0;
- srand(time(0));
- int arr[b];
- for(i=0;i<b;i++)
- arr[i] = (57 + (rand()%(118 - 57 + 1)));
- for(i=0;i<b;i++)
- cout<<arr[i]<<",";
- cout<<endl;
- int x,pr1=1,broqch(0);
- do
- {
- cin>>x;
- }
- while(x<=1 && x>=118);
- for(i=0;i<b;i++)
- {
- if(arr[i]%x==0)
- {
- pr1=pr1*arr[i];
- broqch++;
- }
- }
- if(broqch>0)
- cout<<"proizvedenieto na chislata ot masiva kratni na "<<x<<" e:"<<pr1<<endl;
- else if(broqch==0)
- cout<<"Nqma chisla krani na "<<x<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement