rattrapage jusqu'a adresse

This commit is contained in:
moogin 2024-10-15 12:29:56 +02:00
parent 1ddc2455c8
commit 094a8ed4b1
3 changed files with 275 additions and 0 deletions

62
DEV1.1/biblio_math.c Normal file
View File

@ -0,0 +1,62 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (void){
double x,y,z,a,b,c;
x= sqrt(fabs(log(0.5)));
y=sin(M_PI/6);
z=atan(pow(13.0,2.0));
a=pow(exp(-1.0),4.0);
b=log(-3);
c=pow(sqrt(2),2);
printf("%.2f\n",x);
printf("%.2f\n",y);
printf("%.2f\n",z);
printf("%.2f\n",a);
printf("%.2f\n",b);
printf("%.2f\n",c);
return EXIT_SUCCESS;
}
int main (void){
double ax,bx,ay,by,distance;
printf("Les coordonnées du point A en X et en Y : \n");
scanf("%lf", &ax);
scanf("%lf", &ay);
printf("Les coordonnées du point B en X et en Y : \n");
scanf("%lf", &bx);
scanf("%lf", &by);
distance = sqrt(pow((bx-ax),2)+pow((by-ay),2));
printf("La distance entre les deux points est : %.2f\n", distance);
return EXIT_SUCCESS;
}
int main (void){
double distance,angle,x,y;
printf("Donnez moi la distance et l'angle du point : \n");
scanf("%lf", &distance);
scanf("%lf", &angle);
x= distance* cos(angle);
y= distance* sin(angle);
printf("En X le point est à : %.2f\n", x);
printf("En Y le point est à : %.2f\n", y);
return EXIT_SUCCESS;
}
int main (void){
double reel;
int unite;
int dixieme;
printf("Entrez un réel : ");
scanf("%lf", &reel);
unite = (int)reel % 10;
dixieme = (int)(reel * 10) % 10;
printf("\nchiffre des unités : %d\n", unite);
printf("\nchiffre des dixièmes : %d\n", dixieme);
return EXIT_SUCCESS;
}

View File

@ -2,6 +2,7 @@
#include <stdlib.h>
#include <time.h>
int main (void){
int tableau[10];
int i;
@ -34,5 +35,64 @@ int main (void){
printf("%d", plus_grand);
printf("\n");
return EXIT_SUCCESS;
}
int main(void) {
srand(time(NULL));
int min = 1; // Valeur minimale pour les nombres aléatoires
int max = 100; // Valeur maximale pour les nombres aléatoires
int i;
int tableau[10];
int tableauInverse[10]; // Tableau pour stocker les valeurs inversées
// Remplir le tableau avec des nombres aléatoires
for (i = 0; i < 10; i++) {
tableau[i] = min + rand() % (max - min + 1);
}
// Afficher le tableau initial
printf("+");
for (i = 0; i < 10; i++) {
printf("-----+");
}
printf("\n");
for (i = 0; i < 10; i++) {
printf("|%5d", tableau[i]);
}
printf("|\n");
printf("+");
for (i = 0; i < 10; i++) {
printf("-----+");
}
printf("\n");
// Inverser l'ordre des valeurs
for (i = 0; i < 10; i++) {
tableauInverse[i] = tableau[9 - i];
}
// Afficher le tableau après inversion
printf("\nTableau après inversion:\n");
printf("+");
for (i = 0; i < 10; i++) {
printf("-----+");
}
printf("\n");
for (i = 0; i < 10; i++) {
printf("|%5d", tableauInverse[i]);
}
printf("|\n");
printf("+");
for (i = 0; i < 10; i++) {
printf("-----+");
}
printf("\n");
return EXIT_SUCCESS;
}

153
DEV1.1/tableaux_multi.c Normal file
View File

@ -0,0 +1,153 @@
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int i,t1[2][5], t2[3][5], t3[5][5];
for (i=0; i<5;i++){
t1[0][i] = i+1;
printf("%2d ", t1[0][i]);
}
printf("\n");
for (i=0; i<5;i++){
t1[1][i] = i+1;
printf("%2d ", t1[1][i]);
}
printf("\n\n");
for (i=0; i<5;i++){
t2[0][i] = i+1;
printf("%2d ", t2[0][i]);
}
printf("\n");
for (i=5; i<10;i++){
t2[1][i] = i+1;
printf("%2d ", t2[1][i]);
}
printf("\n");
for (i=10; i<15;i++){
t2[2][i] = i+1;
printf("%2d ", t2[2][i]);
}
printf("\n\n");
for (i=0; i<5;i++){
t3[0][i] = 0;
printf("%2d ", t3[0][i]);
}
printf("\n");
for (i=0; i<1;i++){
t3[1][i] = i+1;
printf("%2d ", t3[1][i]);
}
for (i=1; i<5;i++){
t3[1][i] = 0;
printf("%2d ", t3[1][i]);
}
printf("\n");
for (i=0; i<2;i++){
t3[2][i] = i+1;
printf("%2d ", t3[2][i]);
}
for (i=2; i<5;i++){
t3[2][i] = 0;
printf("%2d ", t3[2][i]);
}
printf("\n");
for (i=0; i<3;i++){
t3[3][i] = i+1;
printf("%2d ", t3[3][i]);
}
for (i=3; i<5;i++){
t3[2][i] = 0;
printf("%2d ", t3[3][i]);
}
printf("\n");
for (i=0; i<4;i++){
t3[4][i] = i+1;
printf("%2d ", t3[4][i]);
}
for (i=4; i<5;i++){
t3[4][i] = 0;
printf("%2d ", t3[4][i]);
}
return EXIT_SUCCESS;
}
int main(void) {
int i,t1[2][5], t2[3][5], t3[5][5];
for (i=0; i<5;i++){
t1[0][i] = i+1;
printf("%2d ", t1[0][i]);
}
printf (" ");
for (i=0; i<5;i++){
t2[0][i] = i+1;
printf("%2d ", t2[0][i]);
}
printf (" ");
for (i=0; i<5;i++){
t3[0][i] = 0;
printf("%2d ", t3[0][i]);
}
printf("\n");
for (i=0; i<5;i++){
t1[1][i] = i+1;
printf("%2d ", t1[1][i]);
}
printf (" ");
for (i=5; i<10;i++){
t2[1][i] = i+1;
printf("%2d ", t2[1][i]);
}
printf (" ");
for (i=0; i<2;i++){
t3[2][i] = i+1;
printf("%2d ", t3[2][i]);
}
for (i=2; i<5;i++){
t3[2][i] = 0;
printf("%2d ", t3[2][i]);
}
printf("\n");
printf(" ");
for (i=10; i<15;i++){
t2[2][i] = i+1;
printf("%2d ", t2[2][i]);
}
printf (" ");
for (i=0; i<3;i++){
t3[3][i] = i+1;
printf("%2d ", t3[3][i]);
}
for (i=3; i<5;i++){
t3[2][i] = 0;
printf("%2d ", t3[3][i]);
}
printf("\n");
printf(" ");
printf(" ");
printf(" ");
for (i=0; i<4;i++){
t3[4][i] = i+1;
printf("%2d ", t3[4][i]);
}
for (i=4; i<5;i++){
t3[4][i] = 0;
printf("%2d\n ", t3[4][i]);
}
return EXIT_SUCCESS;
}