APL/APL1.1/CM1/Foulées.c

35 lines
947 B
C
Raw Normal View History

2021-11-16 14:34:07 +01:00
#include <stdio.h>
#include <stdlib.h>
int main (void){
int distance,tour = 192,nombre_tours,distance_restante,demi_tours;
printf("Entrez une distance en mètres : ");
scanf("%d",&distance);
nombre_tours = distance/tour;
distance_restante = distance - (192*nombre_tours);
if (distance_restante < 96){
if (nombre_tours > 1 ){
printf("Vous avez effectué %d tours\n",nombre_tours);
}
if (nombre_tours == 1 ){
printf("Vous avez éffectué 1 tour\n");
}
if (nombre_tours == 0 ){
printf("Vous n'avez pas efféctué un tour\n");
}
}
else{
if (nombre_tours > 1 ){
printf("Vous avez effectué %d tours et demi\n",nombre_tours);
}
else{
if (nombre_tours = 1 ){
printf("Vous avez éffectué 1 tour et demi\n");
}
if (nombre_tours = 0 ){
printf("Vous n'avez effectué un demi tour\n");
}
}
}
return EXIT_SUCCESS;
}