Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. int main()
  2. {
  3. int zahl, i, j;
  4. int isPrim;
  5. int breakAndCalc;
  6. scanf("%d", &zahl);
  7.  
  8. if(zahl < 2)
  9. {
  10. printf("%d kann nicht zerlegt werden.\n", zahl);
  11. }
  12. else
  13. {
  14. for (j = 2; j > 2 && isPrim == 0 breakAndCalc == 0;j--)
  15. {
  16. if (j == zahl)
  17. {
  18. isPrim++;
  19. printf("%d ist prim.\n", zahl);
  20. }
  21. else
  22. if (zahl % j)
  23. {
  24. breakAndCalc++;
  25.  
  26. printf("%d ist keine prim.\n", zahl);
  27. }
  28. }
  29.  
  30. if (breakAndCalc != 0)
  31. {
  32. for(i=2 ; i <= zahl ; i++)
  33. {
  34. if(zahl % i == 0)
  35. {
  36. zahl = zahl / i;
  37. printf("%d\n", i);
  38. }
  39. }
  40. }
  41. }
  42.  
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement