22 lines
582 B
C
22 lines
582 B
C
|
#include<stdio.h>
|
||
|
#include<stdlib.h>
|
||
|
#include<math.h>
|
||
|
|
||
|
int main(int argc, char * argv[]) {
|
||
|
double airspeed, windspeed, distance;
|
||
|
|
||
|
printf("Veuillez donner la vitesse de l'avion, du vent et la distance à parcourir : ");
|
||
|
scanf("%lf %lf %lf", &airspeed, &windspeed, &distance);
|
||
|
|
||
|
double groundspeed = airspeed - windspeed;
|
||
|
double hoursmins = distance / groundspeed;
|
||
|
int hours = trunc(hoursmins);
|
||
|
int mins = (int)((hoursmins-hours) * 60);
|
||
|
|
||
|
|
||
|
printf("Le vol durera ~%d heure%s et %d minute%s.\n",
|
||
|
hours, hours > 1 ? "s" : "", mins, mins > 1 ? "s" : "");
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|