X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Fbeginners.git;a=blobdiff_plain;f=fact.c;fp=fact.c;h=f24f40adde56fe0896750284a61760d91f3c3106;hp=0000000000000000000000000000000000000000;hb=26bedf2e82579ee793cb437bd4da9370bca7d3df;hpb=62e4aa7ef68064df6c9c2d72734e21af2b672758 diff --git a/fact.c b/fact.c new file mode 100644 index 0000000..f24f40a --- /dev/null +++ b/fact.c @@ -0,0 +1,23 @@ +#include +#include + +int next_teiler(int x) { + int i; + if(x==1) { + printf("\ndone\n"); + exit(0); + } + else { + for(i=2;i<=x;i++) { + if(x%i==0) { + printf("%d ",i); + next_teiler(x/i); + } + } + } +} + +int main(int argc,char *argv[]) { +next_teiler(atoi(argv[1])); +return 0; +}