Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int invoer, resultaat;
  6. printf("Voer een heel getal in.\n");
  7. scanf("%d", &invoer);
  8.  
  9. resultaat = priemcheck;
  10. if (resultaat == 1)
  11. {
  12. printf("%d is een priemgetal\n", invoer);
  13. }
  14. else
  15. {
  16. printf("%d is geen priemgetal\n", invoer);
  17. }
  18. return 0;
  19. }
  20. int priemcheck(int a)
  21. {
  22. int c;
  23. for (c = 2; c <= a - 1; c++)
  24. {
  25. if (a % c == 0)
  26. {
  27. return 0;
  28. }
  29. }
  30.  
  31. return 1;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement