fork download
  1. #include <stdio.h>
  2. int main ()
  3. {
  4. int p, d;
  5. _Bool isPrime;
  6.  
  7. for ( p = 2; p<= 50; ++p ) {
  8. isPrime = 1;
  9.  
  10. for ( d = 2; d < p; ++d )
  11. if ( p % d == 0 )
  12. isPrime = 0;
  13.  
  14. if ( isPrime != 0 )
  15. printf ("%i ", p);
  16.  
  17. }
  18.  
  19.  
  20. printf ("\n");
  21. return (0);
  22. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
2  3  5  7  11  13  17  19  23  29  31  37  41  43  47