Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int b(-1);
  9. while(b<0)
  10. {
  11. cout<<"vuvedete razmer na masiva:"<<endl;
  12. cin>>b;
  13. if(b>40)
  14. b=-1;
  15. }
  16. int i = 0;
  17. srand(time(0));
  18. int arr[b];
  19. for(i=0;i<b;i++)
  20. arr[i] = (57 + (rand()%(118 - 57 + 1)));
  21. for(i=0;i<b;i++)
  22. cout<<arr[i]<<",";
  23. cout<<endl;
  24. int x,pr1=1,broqch(0);
  25. do
  26. {
  27. cin>>x;
  28. }
  29. while(x<=1 && x>=118);
  30. for(i=0;i<b;i++)
  31. {
  32. if(arr[i]%x==0)
  33. {
  34. pr1=pr1*arr[i];
  35. broqch++;
  36. }
  37. }
  38. if(broqch>0)
  39. cout<<"proizvedenieto na chislata ot masiva kratni na "<<x<<" e:"<<pr1<<endl;
  40. else if(broqch==0)
  41. cout<<"Nqma chisla krani na "<<x<<endl;
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement