-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinteger_factorization.c
More file actions
65 lines (42 loc) · 890 Bytes
/
integer_factorization.c
File metadata and controls
65 lines (42 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include<stdio.h>
#include<stdlib.h>
#define FALSE 0
#define TRUE 1
int main()
{
while(1)
{
int number = 0;
int boolean = FALSE;
int primzahl_checker = 2;
int no_primzahl = 0;
printf("Geben Sie eine Zahl ein!\n");
scanf("%d", &number);
while(1)
{
if((primzahl_checker == number) || (primzahl_checker == no_primzahl))
{
break;
}
if( (number % primzahl_checker) == 0)
{
no_primzahl = number / primzahl_checker;
printf("%d\t", no_primzahl);
primzahl_checker++;
boolean = TRUE;
}
else{
primzahl_checker++;
}
}
if(boolean == FALSE)
{
printf("\nPrimzahl ist: %d\n", number);
}
if(boolean == TRUE)
{
printf("\nPrimzahl ist: %d\n", no_primzahl);
}
}
return 0;
}