eg0rmaffin

prime_numbers

Jul 6th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.  
  4. int
  5. prosto (int n)
  6. {
  7.    
  8.     if ((n == 0) || (n == 1) || (n < 0))
  9.       {
  10.           return (0);
  11.       }
  12.   int z = 2;
  13.   while (z < n){
  14.       if (n % z == 0)
  15.     {
  16.       return 0;
  17.     }
  18.     z++;
  19. }
  20.   return 1;
  21.  
  22. }
  23.  
  24.  
  25.  
  26.  
  27. int
  28. main ()
  29. {
  30.   int index;
  31.   prosto (index);
  32.   printf ("%d", prosto (-9));
  33. }
Advertisement
Add Comment
Please, Sign In to add comment