Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. // loop na sequencia
  2. for(int i =n1; i < n2; i++)
  3. {
  4.     // Nenhum número é divisivel por um valor maior que sua metade
  5.     int max = (i / 2);
  6.     for(x = 2; x < max; x++)
  7.     {
  8.         // Se for == 0, então, ele encontrou um número primo e para o laço
  9.         if(!(i % x))
  10.             break;
  11.     }
  12.  
  13.     if(x == max)
  14.         printf("%d é primo\n");
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement