Pas besoin de l pour %lf dans printf

Précisément :
scanf("%d %f %lf", int, float, double)
printf("%d %f %f", int, float, double)
This commit is contained in:
Geoffrey Frogeye 2016-01-17 20:21:31 +01:00
parent 934e50885e
commit 284a26cbd3
4 changed files with 8 additions and 8 deletions

View file

@ -9,6 +9,6 @@ int main() {
printf("Saisissez les coordonnées du point B sous la forme X,Y,Z\n"); printf("Saisissez les coordonnées du point B sous la forme X,Y,Z\n");
scanf("%lf,%lf,%lf", &xb, &yb, &zb); scanf("%lf,%lf,%lf", &xb, &yb, &zb);
double d = sqrt(pow(xb-xa, 2) + pow(yb-ya, 2) + pow(zb-za, 2)); 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; return 0;
} }

View file

@ -11,15 +11,15 @@ int main() {
printf("On a dit a≠0 !\n"); printf("On a dit a≠0 !\n");
} else { } else {
double d = pow(b,2)-4*a*c; double d = pow(b,2)-4*a*c;
printf("%lf\n", d); printf("%f\n", d);
if (d == 0) { if (d == 0) {
printf("x0 = %lf", -b/2*a); printf("x0 = %f", -b/2*a);
} else if (d > 0) { } 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 { } else {
double complex z1 = pow(b,2)/2*a + sqrt(-d)/2*a * I; 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; 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));
} }
} }

View file

@ -9,6 +9,6 @@ int main() {
for (k = 1; k <= n; k++) { for (k = 1; k <= n; k++) {
s += 1/k; // Si k avait été un entier, 1/k aurait été un entier aussi (0) 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; return 0;
} }

View file

@ -21,8 +21,8 @@ int main() {
x = a; x = a;
for (j = 1; j <= jmax; j++) { for (j = 1; j <= jmax; j++) {
x = (x + a/x)/2; 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; return 0;
} }