Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int zahl, i, j;
- int isPrim;
- int breakAndCalc;
- scanf("%d", &zahl);
- if(zahl < 2)
- {
- printf("%d kann nicht zerlegt werden.\n", zahl);
- }
- else
- {
- for (j = 2; j > 2 && isPrim == 0 breakAndCalc == 0;j--)
- {
- if (j == zahl)
- {
- isPrim++;
- printf("%d ist prim.\n", zahl);
- }
- else
- if (zahl % j)
- {
- breakAndCalc++;
- printf("%d ist keine prim.\n", zahl);
- }
- }
- if (breakAndCalc != 0)
- {
- for(i=2 ; i <= zahl ; i++)
- {
- if(zahl % i == 0)
- {
- zahl = zahl / i;
- printf("%d\n", i);
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement