From ec82c210753221fe7132169f1d474a019b5c9cdf Mon Sep 17 00:00:00 2001 From: Jose-maria FULLANA Date: Wed, 6 Oct 2021 20:19:41 +0200 Subject: [PATCH 1/8] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?TP2'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TP2/exo2.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 TP2/exo2.c diff --git a/TP2/exo2.c b/TP2/exo2.c new file mode 100644 index 0000000..1cce3ba --- /dev/null +++ b/TP2/exo2.c @@ -0,0 +1,19 @@ +#include + +int main () { + int a = 5, b=10; + /********************************/ + /* avec une variable auxiliaire */ + /********************************/ + int aux=a; + a=b; + b=aux; + /********************************/ + /* sans variable auxiliaire */ + /********************************/ + a = 5, b=10; + a=a+b; + b=a-b; + a=a-b; + return 1; +} From e7e36c8bcb99362967ae398b6c2e44894c94dca2 Mon Sep 17 00:00:00 2001 From: Jose-maria FULLANA Date: Wed, 6 Oct 2021 20:30:54 +0200 Subject: [PATCH 2/8] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?TP2'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TP2/exo3.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 TP2/exo3.c diff --git a/TP2/exo3.c b/TP2/exo3.c new file mode 100644 index 0000000..bf3fa16 --- /dev/null +++ b/TP2/exo3.c @@ -0,0 +1,17 @@ +#include +int main () { + float a, b, somme ; + + printf("Entrer le premier reel\n") ; + scanf("%f",&a) ; + printf("Entrer le second reel\n") ; + scanf("%f",&b) ; + + somme = a + b; + printf("a + b = %f\n", somme) ; + + printf("%f \n", a/b); + + if (somme < 0) printf("Somme < 0\n"); + else printf("Somme >= 0\n") ; +} From bba3a07749a5ad831d04e018c3038befbeafc1a0 Mon Sep 17 00:00:00 2001 From: Jose-maria FULLANA Date: Wed, 6 Oct 2021 20:31:14 +0200 Subject: [PATCH 3/8] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?TP2'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TP2/pi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 TP2/pi.c diff --git a/TP2/pi.c b/TP2/pi.c new file mode 100644 index 0000000..ca10816 --- /dev/null +++ b/TP2/pi.c @@ -0,0 +1,11 @@ +#include +#include +int main() { + + const float pi = 3.141592653589793 ; + + float pi_tan = acos(-1) ; + + printf("%.16f %.16f %.16f \n",pi,pi_tan,M_PI); + +} From f9db7774c5900e073f58bb878fd8a47a21b7dfdc Mon Sep 17 00:00:00 2001 From: Jose-maria FULLANA Date: Wed, 6 Oct 2021 20:31:30 +0200 Subject: [PATCH 4/8] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?TP2'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TP2/rayon.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 TP2/rayon.c diff --git a/TP2/rayon.c b/TP2/rayon.c new file mode 100644 index 0000000..35abe38 --- /dev/null +++ b/TP2/rayon.c @@ -0,0 +1,12 @@ +#include +int main() { + float rayon ; + float resultat ; + const float pi = 3.141592653589793 ; + + rayon = 10; + resultat = pi * rayon * rayon ; + printf("resultat = %f\n",resultat); + +} + From f7d6bc0405ba5a8527d35933c57bfd022814d9c8 Mon Sep 17 00:00:00 2001 From: Jose-maria FULLANA Date: Wed, 6 Oct 2021 20:31:46 +0200 Subject: [PATCH 5/8] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?TP2'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TP2/rayon2.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 TP2/rayon2.c diff --git a/TP2/rayon2.c b/TP2/rayon2.c new file mode 100644 index 0000000..d9e4e1e --- /dev/null +++ b/TP2/rayon2.c @@ -0,0 +1,14 @@ +#include +int main() { + float x23 ; + float z_230 = 1e1; + float t_340 = 10.; + float oo=1./2*2*1/2; + const float loss = 6.28318/oo*1./4. ; + + + printf("%f %f %f \n",loss, z_230, t_340); + x23 = loss * z_230 * t_340; + printf("resultat = %f\n",x23); + +} From dad45c24e03aac61e37f6eb58182e02261056c0a Mon Sep 17 00:00:00 2001 From: Jose-maria FULLANA Date: Wed, 6 Oct 2021 20:32:29 +0200 Subject: [PATCH 6/8] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?TP3'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TP3/for.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 TP3/for.c diff --git a/TP3/for.c b/TP3/for.c new file mode 100644 index 0000000..f315b50 --- /dev/null +++ b/TP3/for.c @@ -0,0 +1,16 @@ +#include + +int main () { + int max = 5; + + int i ; + + for (i =1 ; i<= max ; i++) { + printf("%d \n",i); + } + /********************************/ + /* valeur à la fin */ + /********************************/ + printf("après la boucle i vaut %d \n",i); + return 1; +} From d58e3a59147f3ea3ae405839902eb3e7c0466601 Mon Sep 17 00:00:00 2001 From: Jose-maria FULLANA Date: Wed, 6 Oct 2021 20:32:46 +0200 Subject: [PATCH 7/8] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?TP3'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TP3/while.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 TP3/while.c diff --git a/TP3/while.c b/TP3/while.c new file mode 100644 index 0000000..5defae6 --- /dev/null +++ b/TP3/while.c @@ -0,0 +1,17 @@ +#include + +int main () { + int max = 5; + + int i = 1; + + while ( i <= max) { + printf("%d \n",i); + i = i + 1 ; + } + /********************************/ + /* valeur à la fin */ + /********************************/ + printf("après la boucle i vaut %d \n",i); + return 1; +} From 474e609763e292af181a4f975d24c941252e1239 Mon Sep 17 00:00:00 2001 From: Jose-maria FULLANA Date: Wed, 6 Oct 2021 20:33:02 +0200 Subject: [PATCH 8/8] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'?= =?UTF-8?q?TP3'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TP3/dowhile.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 TP3/dowhile.c diff --git a/TP3/dowhile.c b/TP3/dowhile.c new file mode 100644 index 0000000..a90ff9c --- /dev/null +++ b/TP3/dowhile.c @@ -0,0 +1,20 @@ +#include + +int main () { + int a = 5; + + int i = 6; + /********************************/ + /* avec une variable auxiliaire */ + /********************************/ + do { + printf("%d \n",i); + i = i + 1 ; + } while (i<= a) ; + /********************************/ + /* valeur à la fin */ + /********************************/ + printf("a la fin i vaut %d \n",i); + return 1; +} +