-------- TP11 : Math -------- 1. # include # include # include # define M_PI 3.14159265358979323846264338379 int main(void) { printf("%f\n", sqrt(fabs(log(0.5)))); printf("%f\n", sin(M_PI/6.0)); printf("%f\n", atan(pow(13.0, 2.0))); printf("%f\n", pow(exp(-1.0), 4.0)); printf("%f\n", log(-3.0)); printf("%f\n", pow(sqrt(2.0), 2.0)); return EXIT_SUCCESS; } 2. # include # include # include # define M_PI 3.14159265358979323846264338379 int main(void) { double xa; double xb; double ya; double yb; printf("Entrez xa : "); scanf("%lf", &xa); getchar(); printf("\nEntrez xb : "); scanf("%lf", &xb); getchar(); printf("\nEntrez ya : "); scanf("%lf", &ya); getchar(); printf("\nEntrez yb : "); scanf("%lf", &yb); getchar(); printf("Distance : %f", sqrt(pow((ya - xa), 2.0) + pow((yb - ya), 2.0))); return EXIT_SUCCESS; } 3. # include # include # include # define M_PI 3.14159265358979323846264338379 int main(void) { double rayon; double angle; printf("Entrez rayon : "); scanf("%lf", &rayon); getchar(); printf("\nEntrez angle (en rad) : "); scanf("%lf", &angle); getchar(); printf("x : %f ; y : %f", rayon*cos(angle), rayon*sin(angle)); return EXIT_SUCCESS; } 4. # include # include # include # define M_PI 3.14159265358979323846264338379 int main(void) { double reel; printf("Entrez un réel : "); scanf("%lf", &reel); printf("chiffre des unités : %d\n", (int) floor(reel) % 10); printf("chiffre des dixièmes : %d\n", (int) floor(reel * 10) % 10); return EXIT_SUCCESS; }