23 lines
500 B
C
23 lines
500 B
C
|
#include<stdio.h>
|
||
|
#include<stdlib.h>
|
||
|
#include<string.h>
|
||
|
|
||
|
#define LONGUEUR_TOUR 192
|
||
|
|
||
|
int main(int argc, char * argv[]) {
|
||
|
int distance;
|
||
|
printf("Entrez une distance en mètres : ");
|
||
|
scanf("%d", &distance);
|
||
|
|
||
|
int nb_tours = distance / LONGUEUR_TOUR;
|
||
|
int demi_tour = (distance % LONGUEUR_TOUR) / (LONGUEUR_TOUR/2);
|
||
|
|
||
|
char reponse[15] = "tour";
|
||
|
if (nb_tours > 1) strcat(reponse, "s");
|
||
|
if (demi_tour == 1) strcat(reponse, " et demi");
|
||
|
|
||
|
printf("%d %s\n", nb_tours, reponse);
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|