"depot M112"
This commit is contained in:
48
TD2/Exercice 3/Exercice 3.cbp
Executable file
48
TD2/Exercice 3/Exercice 3.cbp
Executable file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="Exercice 3" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/Exercice 3" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/Exercice 3" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
</Compiler>
|
||||
<Unit filename="fonctions.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="fonctions.h" />
|
||||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
<lib_finder disable_auto="1" />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
14
TD2/Exercice 3/Exercice 3.depend
Executable file
14
TD2/Exercice 3/Exercice 3.depend
Executable file
@ -0,0 +1,14 @@
|
||||
# depslib dependency file v1.0
|
||||
1537952320 source:f:\cours\dut\m112\projets code block\td2\exercice 3\main.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
|
||||
1537952282 source:f:\cours\dut\m112\projets code block\td2\exercice 3\fonctions.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
"fonctions.h"
|
||||
|
||||
1537951573 f:\cours\dut\m112\projets code block\td2\exercice 3\fonctions.h
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
|
20
TD2/Exercice 3/Exercice 3.layout
Executable file
20
TD2/Exercice 3/Exercice 3.layout
Executable file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Debug" />
|
||||
<File name="fonctions.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="0" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="fonctions.c" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="221" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="218" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
28
TD2/Exercice 3/fonctions.c
Executable file
28
TD2/Exercice 3/fonctions.c
Executable file
@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "fonctions.h"
|
||||
|
||||
int fi(int nb)
|
||||
{
|
||||
int UNm1;
|
||||
int UNm2;
|
||||
int UN;
|
||||
int i = 3;
|
||||
|
||||
UNm2 = 1;
|
||||
UNm1 = 1;
|
||||
|
||||
if (nb <= 2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
while(i != nb)
|
||||
{
|
||||
UN = UNm1 + UNm2;
|
||||
UNm2 = UNm1;
|
||||
UNm1 = UN;
|
||||
i++;
|
||||
}
|
||||
return UN;
|
||||
}
|
4
TD2/Exercice 3/fonctions.h
Executable file
4
TD2/Exercice 3/fonctions.h
Executable file
@ -0,0 +1,4 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int fi(int nb);
|
16
TD2/Exercice 3/main.c
Executable file
16
TD2/Exercice 3/main.c
Executable file
@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int nb;
|
||||
int resu;
|
||||
|
||||
printf("Quelle valeur de la suite voulez vous afficher ?\n");
|
||||
scanf("%d", &nb);
|
||||
|
||||
resu = fi(nb);
|
||||
printf("La %deme valeur de la suite est %d!", nb, resu);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user