Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Ambratolm/b02d924baaa10e427ea88bb8eed3a1a8 to your computer and use it in GitHub Desktop.
Save Ambratolm/b02d924baaa10e427ea88bb8eed3a1a8 to your computer and use it in GitHub Desktop.
Ecrire un algorithme qui convertit un nombre de secondes (entier seconde) en un nombre d’heure, de minutes et de seconds équivalents.
#include<stdio.h>
main()
{
printf("______________________________________________________________\n");
printf("Converteur de secondes en format: heures : minutes : secondes\n");
printf("--------------------------------------------------------------\n");
int X, H, M, S, R;
printf("\n");
printf("Entrez le nombre de secondes: ");
scanf("%d",&X);
H=X/3600;
R=X-(H*3600);
M=R/60;
S=R-(M*60);
printf("--------------------------------------------------------------\n");
printf("\n");
printf("%d secondes = %d heures : %d minutes : %d secondes", X,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