SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. for (int j=2;j<=545;j++){//por definicion el 1 no es primo, se empieza en 2
  6.     int a=0;
  7.     for(int i=1;i<=545;i++)//divide a j entre los números del 1 al 100
  8.     {
  9.         if(j%i==0) // si num1 módulo de i es 0, incrementamos a en 1.
  10.         a++;
  11.     }
  12.     if (a==2){ //si solo tiene dos números divisores entonces es primo y se imprime
  13.     printf("%d\n", j);
  14.     }
  15. }
  16. getchar();
  17. return 0;
  18. }
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