21 septembre
This commit is contained in:
parent
a55a2bf603
commit
1e063977ab
@ -1,15 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
double x;
|
||||
char c;
|
||||
printf("Veuillez saisir un reel.\n");
|
||||
n = scanf("%lf", &x);
|
||||
printf("Sa notation scientifique est : %f\n",x);
|
||||
printf("Veuillez saisir un caractere.\n");
|
||||
n = scanf("%c", &c);
|
||||
printf("J'ecris ce dernier 5 fois : %c %c %c %c %c\n",c,c,c,c,c);
|
||||
|
||||
return 0;
|
||||
}
|
BIN
DEV1.1/TP02:Caracteres,Reels/.nfs000000000046254e00000025
Executable file
BIN
DEV1.1/TP02:Caracteres,Reels/.nfs000000000046254e00000025
Executable file
Binary file not shown.
BIN
DEV1.1/TP02:Caracteres,Reels/.nfs0000000000462b9000000026
Executable file
BIN
DEV1.1/TP02:Caracteres,Reels/.nfs0000000000462b9000000026
Executable file
Binary file not shown.
17
DEV1.1/TP02:Caracteres,Reels/interets.c
Normal file
17
DEV1.1/TP02:Caracteres,Reels/interets.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
double n;
|
||||
int i;
|
||||
i=0;
|
||||
printf("Combien voulez vous invetir?\n");
|
||||
scanf("%lf",&n);
|
||||
printf("Vous avez investit %.3f euros.\n",n);
|
||||
while (i!=7){
|
||||
n=n+n*0.04;
|
||||
printf("Apres %d ans votre epargne est de %9.3f euros.\n",i,n);
|
||||
i=i+1;}
|
||||
printf("Apres %d ans votre epargne est de %9.3f euros.\n",i,n);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,15 +1,14 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
double x;
|
||||
char c;
|
||||
printf("Veuillez saisir un reel.\n");
|
||||
n = scanf("%lf", &x);
|
||||
scanf("%lf",&x);
|
||||
printf("Sa notation scientifique est : %e\n",x);
|
||||
printf("Veuillez saisir un caractere.\n");
|
||||
n = scanf("%c", &c);
|
||||
char c;
|
||||
scanf(" %c",&c); //mettre un espace empeche le programme de lire le retour à la ligne.
|
||||
printf("J'ecris ce dernier 5 fois : %c %c %c %c %c\n",c,c,c,c,c);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
18
DEV1.1/TP03:Conditions/billevesees.c
Normal file
18
DEV1.1/TP03:Conditions/billevesees.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int x;
|
||||
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 0;
|
||||
}
|
6
DEV1.1/TP03:Conditions/bissextile.c
Normal file
6
DEV1.1/TP03:Conditions/bissextile.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
|
||||
return 0;
|
||||
}
|
32
DEV1.1/TP03:Conditions/ordre.c
Normal file
32
DEV1.1/TP03:Conditions/ordre.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
printf("Veuillez saisir 3 entiers.\n");
|
||||
scanf("%d %d %d",&a,&b,&c);
|
||||
if (a>b){
|
||||
if (a>c){
|
||||
if (b>c){
|
||||
printf("Dans l'ordre croisant, les valeurs sont: %d %d %d\n",c,b,a);
|
||||
} else{
|
||||
printf("Dans l'ordre croisant, les valeurs sont: %d %d %d\n",b,c,a);
|
||||
}
|
||||
} else{
|
||||
printf("Dans l'ordre croisant, les valeurs sont: %d %d %d\n",b,a,c);
|
||||
}
|
||||
} else{
|
||||
if (b>c){
|
||||
if (a>c){
|
||||
printf("Dans l'ordre croisant, les valeurs sont: %d %d %d\n",c,a,b);
|
||||
} else{
|
||||
printf("Dans l'ordre croisant, les valeurs sont: %d %d %d\n",a,c,b);
|
||||
}
|
||||
} else{
|
||||
printf("Dans l'ordre croisant, les valeurs sont: %d %d %d\n",a,b,c);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
18
DEV1.1/TP03:Conditions/produit.c
Normal file
18
DEV1.1/TP03:Conditions/produit.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
float n;
|
||||
float m;
|
||||
printf("Veuillez saisir 2 reels.\n");
|
||||
scanf("%f %f",&n,&m);
|
||||
if (n>0 && m>0){
|
||||
printf("Le produit sera positif.\n");
|
||||
} else{
|
||||
if (n<0 && m<0){
|
||||
printf("Le produit sera positif.\n");
|
||||
} else{
|
||||
printf("Le produit sera negatif.\n");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
21
DEV1.1/TP03:Conditions/triple.c
Normal file
21
DEV1.1/TP03:Conditions/triple.c
Normal file
@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int n;
|
||||
printf("Veuillez saisir un entier naturel.\n");
|
||||
scanf("%d",&n);
|
||||
if (n%3==0 || n%3==1){
|
||||
if (n%3==0){
|
||||
printf("%d est deja un multiple de 3.\n",n);
|
||||
} else {
|
||||
printf("Le multiple de 3 le plus proche est %d\n",n-1);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (n%3==2){
|
||||
printf("Le multiple de 3 le plus proche est %d\n",n+1);
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user