33 lines
602 B
C
33 lines
602 B
C
/* Convertisseur de devises */
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#define TAUX_CHANGE 1.20
|
|
|
|
float calcul_dollar(float, float);
|
|
|
|
int main() {
|
|
float euro, dollar;
|
|
float taux_change = TAUX_CHANGE;
|
|
|
|
printf("Entrez un montant en € : ");
|
|
fflush(stdin);
|
|
scanf("%f", &euro);
|
|
|
|
dollar = calcul_dollar(euro, taux_change);
|
|
|
|
printf("Vous avez donc $%g\n", dollar);
|
|
|
|
return 0;
|
|
}
|
|
|
|
float calcul_dollar(float euro, float taux_change) {
|
|
float dollar;
|
|
|
|
printf("Le taux de change €->$ est de %g.\n", taux_change);
|
|
|
|
dollar = euro * taux_change;
|
|
|
|
return dollar;
|
|
}
|