From 284a26cbd3a7fb744661d1b711f52d66c76115cd Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Sun, 17 Jan 2016 20:21:31 +0100 Subject: [PATCH] Pas besoin de l pour %lf dans printf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Précisément : scanf("%d %f %lf", int, float, double) printf("%d %f %f", int, float, double) --- TP1/E2.c | 2 +- TP1/E3.c | 8 ++++---- TP1/E4.c | 2 +- TP1/E6.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TP1/E2.c b/TP1/E2.c index b5c6ff1..d6b707a 100644 --- a/TP1/E2.c +++ b/TP1/E2.c @@ -9,6 +9,6 @@ int main() { printf("Saisissez les coordonnées du point B sous la forme X,Y,Z\n"); scanf("%lf,%lf,%lf", &xb, &yb, &zb); double d = sqrt(pow(xb-xa, 2) + pow(yb-ya, 2) + pow(zb-za, 2)); - printf("AB = %lf\n", d); + printf("AB = %f\n", d); return 0; } diff --git a/TP1/E3.c b/TP1/E3.c index a21a308..e2a1738 100644 --- a/TP1/E3.c +++ b/TP1/E3.c @@ -11,15 +11,15 @@ int main() { printf("On a dit a≠0 !\n"); } else { double d = pow(b,2)-4*a*c; - printf("%lf\n", d); + printf("%f\n", d); if (d == 0) { - printf("x0 = %lf", -b/2*a); + printf("x0 = %f", -b/2*a); } else if (d > 0) { - printf("x1 = %lf; x2 = %lf", (-b+sqrt(d))/2*a, (-b-sqrt(d))/2*a); + printf("x1 = %f; x2 = %f", (-b+sqrt(d))/2*a, (-b-sqrt(d))/2*a); } else { double complex z1 = pow(b,2)/2*a + sqrt(-d)/2*a * I; double complex z2 = pow(b,2)/2*a - sqrt(-d)/2*a * I; - printf("z1 = %lf+i%lf; z2 = %lf+i%lf\n", creal(z1), cimag(z1), creal(z2), cimag(z2)); + printf("z1 = %f+i%f; z2 = %f+i%f\n", creal(z1), cimag(z1), creal(z2), cimag(z2)); } } diff --git a/TP1/E4.c b/TP1/E4.c index 61755de..e7bbd1f 100644 --- a/TP1/E4.c +++ b/TP1/E4.c @@ -9,6 +9,6 @@ int main() { for (k = 1; k <= n; k++) { s += 1/k; // Si k avait été un entier, 1/k aurait été un entier aussi (0) } - printf("%lf\n", s); + printf("%f\n", s); return 0; } diff --git a/TP1/E6.c b/TP1/E6.c index 06e1dd1..f09ce96 100644 --- a/TP1/E6.c +++ b/TP1/E6.c @@ -21,8 +21,8 @@ int main() { x = a; for (j = 1; j <= jmax; j++) { x = (x + a/x)/2; - printf("La %dème approximation de la racine carrée de %lf est %lf.\n", j, a, x); + printf("La %dème approximation de la racine carrée de %f est %f.\n", j, a, x); } - printf("%lf\n", x); + printf("%f\n", x); return 0; }