SHARE
TWEET

Untitled

razvanth21 Dec 9th, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int suma_elementelor_prime(int a[100])
  2. {
  3.     int i, j, s = 0, prim;
  4.     for (i = 0; i < 100; i++)
  5.     {
  6.         prim = 0;
  7.         for (j = 2; j <= sqrt(a[i]); j++) {
  8.             if (a[i] % j == 0)
  9.                 prim = 1;
  10.         }
  11.        
  12.         if (prim == 0)
  13.         {
  14.             cout << a[i] << " ";
  15.             s = s + a[i];
  16.         }
  17.     }
  18.    
  19.     return s;
  20. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top