"depot M112"
This commit is contained in:
43
TD1/exo2/exo2.cbp
Executable file
43
TD1/exo2/exo2.cbp
Executable file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="exo2" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/exo2" 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/exo2" 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="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
5
TD1/exo2/exo2.depend
Executable file
5
TD1/exo2/exo2.depend
Executable file
@ -0,0 +1,5 @@
|
||||
# depslib dependency file v1.0
|
||||
1537264359 source:f:\cours\dut\m112\projets code block\exo2\main.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
|
10
TD1/exo2/exo2.layout
Executable file
10
TD1/exo2/exo2.layout
Executable file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Debug" />
|
||||
<File name="main.c" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="721" topLine="9" />
|
||||
</Cursor>
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
36
TD1/exo2/main.c
Executable file
36
TD1/exo2/main.c
Executable file
@ -0,0 +1,36 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
/*Exercice 2 - Partie 1*/
|
||||
double tab[4] = {10, 20, -15, 30};
|
||||
double total = 0;
|
||||
|
||||
/*Exercice 2 - Partie 2*/
|
||||
double tab2[10];
|
||||
double total2 = 0;
|
||||
|
||||
/*Exercice 2 - Partie 1*/
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
total = total + tab[i];
|
||||
}
|
||||
printf("Voici la reponse de l'exercice 1 :\n");
|
||||
printf("%lf\n\n\n", total);
|
||||
|
||||
/*Exercice 2 - Partie 2*/
|
||||
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
printf("Entrez la valeur %d du tableau\n", i+1);
|
||||
scanf("%lf", &tab2[i]);
|
||||
total2 = total2 + tab2[i];
|
||||
}
|
||||
printf("Voici la reponse de l'exercice 2 :\n");
|
||||
printf("%lf\n\n\n", total2);
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user