Advertisement
Dizzy3113

Untitled

Nov 10th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int calcul(int n, int a[100])
  6. {
  7. int c=0, d, div;
  8. for(int i=1; i<=n; i++)
  9. {
  10. div=0;
  11. for(d=2; d<a[i]/2; d++)
  12. {
  13. if(a[i]%d==0)
  14. div++;
  15.  
  16. }
  17. if(div==0)
  18. c++;
  19. }
  20. return c;
  21. }
  22.  
  23. int main()
  24. {
  25. int n=5, a[100]={12,37,43,6,71};
  26. cout<<calcul(n,a);
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement