Created
June 25, 2017 11:47
-
-
Save Ambratolm/85c52727af441671a44860c6f8334471 to your computer and use it in GitHub Desktop.
Ecrire un programme qui lit un nombre de secondes entier au clavier et puis affiche cette durée en jours, heures, minutes et secondes au format suivant : « La durée saisie se décompose en : x jours, x heures, x minutes et x secondes. »
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
main() | |
{ | |
printf("_____________________________________________________________________\n"); | |
printf("Converteur de secondes en format: jours : heures : minutes : secondes\n"); | |
printf("---------------------------------------------------------------------\n"); | |
int X, J, H, M, S, R1,R2; | |
printf("\n"); | |
printf("Entrez le nombre de secondes: "); | |
scanf("%d",&X); | |
J=X/86400; | |
R1=X-(J*86400); | |
H=R1/3600; | |
R2=R1-(H*3600); | |
M=R2/60; | |
S=R2-(M*60); | |
printf("---------------------------------------------------------------------\n"); | |
printf("\n"); | |
printf("%d secondes = %d jours : %d heures : %d minutes : %d secondes", X,J,H,M,S); | |
printf("\n"); | |
system("pause"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment