SHARE
TWEET

Untitled

a guest Dec 10th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int prim(int n)
  2. {
  3.     int d=2;
  4.     if(n<2)
  5.         return 0;
  6.     while(d*d<=n && n%d!=0)
  7.         d++;
  8.     if(d*d<=n)
  9.         return 0;
  10.     else
  11.         return 1;
  12. }
  13. void P(int x[101],  int n , int &s)
  14. {
  15.     int m;
  16.     s=0;
  17.     for(int i=0;i<n;i++)
  18.     {
  19.         m=x[i];
  20.         if(prim(m)==1)
  21.             s=s+m;
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top