TD1 E9
This commit is contained in:
parent
1b197a92fa
commit
6fc5577666
18
TP1/E9.c
Normal file
18
TP1/E9.c
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/* Calcule un produit scalaire */
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
double U[3];
|
||||||
|
double V[3];
|
||||||
|
|
||||||
|
printf("Entrez les coordonnées de U séparées par des virgules\n");
|
||||||
|
scanf("%lf,%lf,%lf", &U[0], &U[1], &U[2]);
|
||||||
|
printf("Entrez les coordonnées de V séparées par des virgules\n");
|
||||||
|
scanf("%lf,%lf,%lf", &V[0], &V[1], &V[2]);
|
||||||
|
|
||||||
|
printf("U·V=%f\n", U[0]*V[0]+U[1]*V[1]+U[2]*V[2]);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -30,6 +30,9 @@ E7.exe: E7.c
|
||||||
E8.exe: E8.c
|
E8.exe: E8.c
|
||||||
gcc E8.c -o E8.exe
|
gcc E8.c -o E8.exe
|
||||||
|
|
||||||
|
E9.exe: E9.c
|
||||||
|
gcc E9.c -o E9.exe
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
Reference in a new issue