Controle
This commit is contained in:
parent
dc0bdf3438
commit
95be98b88e
BIN
APL1.1/CMB1/Distribution
Executable file
BIN
APL1.1/CMB1/Distribution
Executable file
Binary file not shown.
37
APL1.1/CMB1/Distribution.c
Normal file
37
APL1.1/CMB1/Distribution.c
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#define rangée 4
|
||||||
|
#define billes 2
|
||||||
|
int main(void){
|
||||||
|
int proba = 1/(rangée*2);
|
||||||
|
int i,j,k,l;
|
||||||
|
int a[rangée+1] = {};
|
||||||
|
srand(time(NULL));
|
||||||
|
int var = rand()%rangée*2+1;
|
||||||
|
for (i=0;i<=billes-1;i++){
|
||||||
|
if (var == 1 ){
|
||||||
|
a[0] = a[0]+1;
|
||||||
|
}
|
||||||
|
if (var == rangée*2){
|
||||||
|
a[rangée-1]=a[var-1]+1;
|
||||||
|
}
|
||||||
|
if (var != rangée || var != 1){
|
||||||
|
if (var%2 != 0){
|
||||||
|
a[var-1]= a[var-1]+1;
|
||||||
|
}else{
|
||||||
|
a[var]=a[var]+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (k=0;k<rangée;k++){
|
||||||
|
for (l=0;l<a[k];l++){
|
||||||
|
printf("▄");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
BIN
APL1.1/CMB1/Histogramme
Executable file
BIN
APL1.1/CMB1/Histogramme
Executable file
Binary file not shown.
15
APL1.1/CMB1/Histogramme.c
Normal file
15
APL1.1/CMB1/Histogramme.c
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#define capacité 10
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int a[capacité] = {1,3,5,6};
|
||||||
|
int i,j;
|
||||||
|
for (i=0;i<capacité;i++){
|
||||||
|
for (j=0;j<a[i];j++){
|
||||||
|
printf("▄");
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
BIN
APL1.1/CMB1/Parité
Executable file
BIN
APL1.1/CMB1/Parité
Executable file
Binary file not shown.
16
APL1.1/CMB1/Parité.c
Normal file
16
APL1.1/CMB1/Parité.c
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int a,b;
|
||||||
|
printf("entrez le premier entier : ");
|
||||||
|
scanf("%d",&a);
|
||||||
|
printf("entrez le deuxieme entier : ");
|
||||||
|
scanf("%d",&a);
|
||||||
|
if (a%2==0 || b%2 == 0){
|
||||||
|
printf("pair\n");
|
||||||
|
}else{
|
||||||
|
printf("impaire\n");
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
BIN
APL1.1/CMB1/Triage
Executable file
BIN
APL1.1/CMB1/Triage
Executable file
Binary file not shown.
16
APL1.1/CMB1/Triage.c
Normal file
16
APL1.1/CMB1/Triage.c
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
float x = 2.0;
|
||||||
|
int y = 02;
|
||||||
|
long int z = 2L;
|
||||||
|
signed char w = '\0x32';
|
||||||
|
int a = (float) x;
|
||||||
|
int b = (int) y;
|
||||||
|
int c = (long int) z;
|
||||||
|
int d = (unsigned char) w;
|
||||||
|
printf(" %d \n %d \n %d \n %c \n",a,b,c,d);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user