rajout de boucle et mise a jour de condition

This commit is contained in:
moogin 2024-09-17 15:06:12 +02:00
parent fb69d789be
commit 29ee1f20bf

61
DEV1.1/boucles.c Normal file
View File

@ -0,0 +1,61 @@
#include <stdio.h>
#include <stdlib.h>
/*int main(void){
int x = 0;
int y = 0;
int difference = 0;
int i;
printf ("donnner deux entier pour realiser la sequence : \n");
scanf("%d", &x);
scanf("%d", &y);
if(x > y){
difference = x - y;
for (i = 0 ; i <difference; i++){
y = y + 1;
printf("sequence: %d\n", y);
}
}
if(x < y){
difference = y - x;
for (i = 0 ; i <difference; i++){
y = y - 1;
printf("sequence: %d\n", y);
}
}
}*/
int main(void){
int entrer = 0;
int n = 3;
int chance;
int epargne;
int annee = 0;
printf("veulliez renter l'argent que voous souhaitez deposer choisissez entre 1000 et 50000 euro vous aurez 3 chances\n");
for (chance = 0; chance < 3; chance++){
scanf("%d", &entrer);
if (entrer < 1000 || entrer > 50000){
n--;
printf("entrez un nombre en 1000 et 50000 il vous reste : ");
printf("%d", n);
printf(" chance\n");
}else{
for(epargne = 0; epargne < 7; epargne++){
entrer *= 1.07;
annee++;
printf("votre epargne sera de ");
printf("%d", entrer);
printf(" dans ");
printf("%d", annee);
printf("ans\n");
}
return EXIT_SUCCESS;
}
}
}