bonjour
This commit is contained in:
parent
81df25baf0
commit
4506759c1a
1
APL1.1/CMB1/APL
Submodule
1
APL1.1/CMB1/APL
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 81df25baf0d72d490ab598dea728ea8606f5d537
|
BIN
APL1.1/CMB1/DistributionTO
Executable file
BIN
APL1.1/CMB1/DistributionTO
Executable file
Binary file not shown.
63
APL1.1/CMB1/DistributionTO.c
Normal file
63
APL1.1/CMB1/DistributionTO.c
Normal file
@ -0,0 +1,63 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#define ETAGES 4
|
||||
#define NBRBILLES 10
|
||||
|
||||
int main (void) {
|
||||
|
||||
int i,y,z,compteur=0,direction,trou,comptg,comptd;
|
||||
int resultats[NBRBILLES];
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
for(y=0; y<NBRBILLES; y++){
|
||||
trou=3;
|
||||
comptg=1;
|
||||
comptd=0;
|
||||
for(i=0; i<ETAGES; i++){
|
||||
direction=rand()%2;
|
||||
if(direction==0){
|
||||
if(comptg==1){
|
||||
trou--;
|
||||
comptg--;
|
||||
comptd++;
|
||||
} else {
|
||||
comptg++;
|
||||
comptd--;
|
||||
}
|
||||
}
|
||||
if (direction==1){
|
||||
if(comptd==1){
|
||||
trou++;
|
||||
comptg++;
|
||||
comptd--;
|
||||
} else {
|
||||
comptd++;
|
||||
comptg--;
|
||||
}
|
||||
}
|
||||
}
|
||||
resultats[y]=trou;
|
||||
}
|
||||
|
||||
for(y=0; y<5; y++){
|
||||
for (z=0; z<NBRBILLES; z++){
|
||||
if(resultats[z]==y+1){
|
||||
compteur++;
|
||||
}
|
||||
}
|
||||
printf("\nBilles tombées dans le trou %d : ", y+1);
|
||||
for (i=0; i<compteur; i++){
|
||||
printf("▄");
|
||||
}
|
||||
//printf("%d\n", compteur); //pour vérif
|
||||
compteur=0;
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
||||
}
|
BIN
APL1.1/CMB1/Historigramme
Executable file
BIN
APL1.1/CMB1/Historigramme
Executable file
Binary file not shown.
27
APL1.1/CMB1/Historigramme.c
Normal file
27
APL1.1/CMB1/Historigramme.c
Normal file
@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#define TAILLETAB 20
|
||||
|
||||
int main (void){
|
||||
|
||||
int tab[TAILLETAB];
|
||||
int i,r;
|
||||
|
||||
srand(time(NULL));
|
||||
|
||||
/* ajoute TAILLETAB valeurs dans un tableau entre 0 et 20 */
|
||||
|
||||
for(i=0; i<TAILLETAB; i++){
|
||||
tab[i]=rand()%21;
|
||||
/*printf("%d\n", tab[i]);*/ /*pour vérifier*/
|
||||
}
|
||||
|
||||
for(i=0; i<TAILLETAB; i++){
|
||||
for(r=0; r<tab[i]; r++){
|
||||
printf("▄");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
}
|
3
APL1.1/CMB1/historigramme.c
Normal file
3
APL1.1/CMB1/historigramme.c
Normal file
@ -0,0 +1,3 @@
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
int char =
|
BIN
APL1.1/CMB1/parite
Executable file
BIN
APL1.1/CMB1/parite
Executable file
Binary file not shown.
22
APL1.1/CMB1/parité.c
Normal file
22
APL1.1/CMB1/parité.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
int main(void){
|
||||
int saisie1, saisie2;
|
||||
|
||||
printf("Premier entier : ");
|
||||
scanf("%d", &saisie1);
|
||||
|
||||
printf("Deuxieme entier : ");
|
||||
scanf("%d", &saisie2);
|
||||
|
||||
if ((saisie1%2)!=0 && (saisie2%2)!=0){
|
||||
printf("La multiplication de %d et %d donne un résultat impair.\n", saisie1, saisie2);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
printf("La multiplication de %d et %d donne un résultat pair.\n", saisie1, saisie2);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
BIN
APL1.1/CMB1/rapace
Executable file
BIN
APL1.1/CMB1/rapace
Executable file
Binary file not shown.
9
APL1.1/CMB1/rapace.c
Normal file
9
APL1.1/CMB1/rapace.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
int main(void){
|
||||
printf(" (o,o)\n");
|
||||
printf(" (__(\\\n");
|
||||
printf(" -\"-\"-\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
/*avec ce programme, je pense que cela affichera le programme demande. je n'ai pas réussi à le compiler avec gcc rapace.c rapace*/
|
5
APL1.1/CMB1/triage.c
Normal file
5
APL1.1/CMB1/triage.c
Normal file
@ -0,0 +1,5 @@
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
int main(void){
|
||||
int main(char){
|
||||
printf("%2
|
Loading…
Reference in New Issue
Block a user