Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Projet_Q4_Groupe_O4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Louis Malevez
Projet_Q4_Groupe_O4
Commits
6e6b2501
Commit
6e6b2501
authored
Apr 20, 2020
by
Louis Malevez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fonction qui factorise en facteur premier
parent
6926cfcf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
primef.h
primef.h
+39
-0
No files found.
primef.h
0 → 100644
View file @
6e6b2501
//
// Created by Louis Malevez on 19-04-20.
//
#ifndef PROJET_Q4_GROUPE_O4_PRIMEF_H
#define PROJET_Q4_GROUPE_O4_PRIMEF_H
# include <stdio.h>
# include <math.h>
int
primeFactors
(
int
n
,
FILE
*
f_out
);
int
primeFactors
(
int
n
,
FILE
*
f_out
){
// prends un fichier et écrit un entier et ses diviseurs dedans
int
count1
=
0
;
int
count2
=
0
;
fprintf
(
f_out
,
"%d "
,
n
);
while
(
n
%
2
==
0
)
{
if
(
count1
==
0
)
fprintf
(
f_out
,
"%d "
,
2
);
n
=
n
/
2
;
count1
+=
1
;
}
for
(
int
i
=
3
;
i
*
i
<=
n
;
i
=
i
+
2
)
{
while
(
n
%
i
==
0
){
if
(
count2
==
0
)
fprintf
(
f_out
,
"%d "
,
i
);
n
=
n
/
i
;
count2
+=
1
;
}
count2
=
0
;
}
if
(
n
>
2
)
fprintf
(
f_out
,
"%d "
,
n
);
fprintf
(
f_out
,
"
\n
"
);
//passe à la ligne qd c'es terminé
return
0
;
}
#endif //PROJET_Q4_GROUPE_O4_PRIMEF_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment