Mise à jour de mes travaux
This commit is contained in:
@@ -0,0 +1,16 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
printf("%d\n", 100/6);
|
||||||
|
printf("%d\n", 100%6);
|
||||||
|
printf("%d\n", 0x1A*015);
|
||||||
|
printf("%d\n", -3/5);
|
||||||
|
printf("%d\n", -31/5);
|
||||||
|
printf("%d\n", -31%5);
|
||||||
|
printf("%d\n", 100*(3/5));
|
||||||
|
printf("%d\n", 100*3/5);
|
||||||
|
printf("%d\n", 2-3-5);
|
||||||
|
printf("%d\n", 2-(3-5));
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
printf("%d\n", 72);
|
||||||
|
printf("%d\n", 0110);
|
||||||
|
printf("%d\n", 0x48);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int n = 1; // qui va augmenter
|
||||||
|
int precedent = 1; // on garde la derniere
|
||||||
|
|
||||||
|
while (n > 0) // tant que n est + pcq basculer en - cest le signal d'arret, le nb est rempli de 1)
|
||||||
|
{
|
||||||
|
precedent = n; // on garde la veleur avant de depasser la limite
|
||||||
|
n = n*2+1; // o doube a chaque fois et on ajoute & pour les bits
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("plus grand entier : %d\n", precedent);
|
||||||
|
printf("en octal : %o\n", precedent);
|
||||||
|
printf"en hexa : %x\n", precedent);
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
OPERATIONS (trouvez ou est l'erreur dans le programme)
|
||||||
|
|
||||||
|
l'erreur est à la dernière ligne ici : printf("%f\n", 5.0%2.5);
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
EXTREMITES
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
printf("%f\n", +1.0/0.0);
|
||||||
|
printf("%f\n", -1.0/0.0);
|
||||||
|
printf("%f\n", -0.0/0.0);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
le premier printf : +1.0/0.0 donnera + l'infini car on divise un réel positif par 0
|
||||||
|
le second printf : -1.0/0.0 donnera - l'infini car on divise un réél négatif par 0
|
||||||
|
le dernier print f : -0.0/0.0 donnera une forme indéterminée
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
double capital ;
|
||||||
|
printf("Combien d'euros voulez vous investir?");
|
||||||
|
scanf("%f", capital);
|
||||||
|
|
||||||
|
capital = capital * 1,04;
|
||||||
|
printf("Après 1 an : %.2f euros\n", captital);
|
||||||
|
|
||||||
|
capital = capital * 1,04;
|
||||||
|
printf("Après 2 ans : %.2f euros\n", captital);
|
||||||
|
|
||||||
|
capital = capital * 1,04;
|
||||||
|
printf("Après 1 an : %.2f euros\n", captital);
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
int main(void) {
|
||||||
|
printf("%f\n", 12345.678910111213);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main2(void) {
|
||||||
|
printf("%.12f\n", 12345.678910111213);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main3(void) {
|
||||||
|
printf("%.15f\n", 12345.678910111213);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
float nombre ;
|
||||||
|
char caractere;
|
||||||
|
|
||||||
|
printf("entrez un réel : ");
|
||||||
|
scanf("%f", nombre);
|
||||||
|
|
||||||
|
printf("en notation sci : %e\n", nombre);
|
||||||
|
|
||||||
|
printf("entrez un caractere : ");
|
||||||
|
scanf(" %c", caractere);
|
||||||
|
|
||||||
|
printf("%c", caractere);
|
||||||
|
printf("%c", caractere);
|
||||||
|
printf("%c", caractere);
|
||||||
|
printf("%c", caractere);
|
||||||
|
printf("%c", caractere);
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
print
|
||||||
Executable
BIN
Binary file not shown.
@@ -0,0 +1,26 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int x=3;
|
||||||
|
|
||||||
|
if (x=2) {
|
||||||
|
printf("x vaut 2\n");
|
||||||
|
} else {
|
||||||
|
printf("x est different de 2\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d\n", x);
|
||||||
|
|
||||||
|
if (x=0) {
|
||||||
|
printf("x vaut 0\n");
|
||||||
|
} else {
|
||||||
|
printf("x est different de 0\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d\n", x);
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* il faut le double symbole égal dans les deux if */
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int a;
|
||||||
|
int b;
|
||||||
|
|
||||||
|
printf("entrez un premier réel :");
|
||||||
|
scanf("%d", &a);
|
||||||
|
printf("entrez un second réel:");
|
||||||
|
scanf("%d", &b);
|
||||||
|
|
||||||
|
int multiplication = a * b
|
||||||
|
|
||||||
|
if (multiplication < 0)
|
||||||
|
printf("le signe de la multiplication est négatif");
|
||||||
|
else
|
||||||
|
printf("le signe de la multiplication est positif");
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int n ;
|
||||||
|
|
||||||
|
printf("entrez un entier naturel :");
|
||||||
|
scanf(%d, &n);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return EXIT_SUCCESS
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
int a, b ;
|
||||||
|
|
||||||
|
printf("entrez une valeur entière supérieure ou égal à 0 :");
|
||||||
|
scanf("%d", &a);
|
||||||
|
|
||||||
|
printf("entrez une valeur entière strictement supérieure à 0 :");
|
||||||
|
scanf("%d", &b);
|
||||||
|
|
||||||
|
int quotient = 0, reste = a ;
|
||||||
|
while (reste >= b) {
|
||||||
|
reste = reste - b;
|
||||||
|
quotient = quotient + 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
printf("--> %d = %d * %d + %d", a , quotient, b, reste);
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
double inv;
|
||||||
|
("Entrez une valeur d'investissement comprise entre 1000 euros et 10000 euros");
|
||||||
|
scanf("%f", inv);
|
||||||
|
|
||||||
|
while ( 1000 >= inv <= 10000) {
|
||||||
|
pr
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
int x, y, z;
|
||||||
|
printf("entrez un entier : ");
|
||||||
|
scanf("%d", &x);
|
||||||
|
|
||||||
|
while (y <= 10) {
|
||||||
|
z = x*y;
|
||||||
|
printf("%d * %d = %d", x, y, z)
|
||||||
|
};
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
16 (la partie decimale de 16.666 coupé)
|
||||||
|
4 (reste)
|
||||||
|
|
||||||
|
0 ( -0.6 arrondit)
|
||||||
|
-6 (-6.2 arrondit?)
|
||||||
|
-1 (reste)
|
||||||
|
0( la parenthèse fait 0.6 arrondit a 0 le tout fois 100.)
|
||||||
|
60 (300 par 5 ca fait 60)
|
||||||
|
-6
|
||||||
|
4
|
||||||
Reference in New Issue
Block a user