All pastes #178656 Raw Edit

Divers

public c v1 · immutable
#178656 ·published 2006-09-21 13:24 UTC
rendered paste body
/*************************************************************************** *   Copyright (C) 2006 by sephiroth   * *   sephiroth@localhost   * *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * *   This program is distributed in the hope that it will be useful,       * *   but WITHOUT ANY WARRANTY; without even the implied warranty of        * *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         * *   GNU General Public License for more details.                          * *                                                                         * *   You should have received a copy of the GNU General Public License     * *   along with this program; if not, write to the                         * *   Free Software Foundation, Inc.,                                       * *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * ***************************************************************************/#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <stdio.h>#include <stdlib.h>long int sec = 0;int main(int argc, char *argv[]){  int choice;  do  {       printf("Que voulez vous faire?\n1 : Convertir des secondes en h/min/sec\n2 : Quitter ce programme\n\n");       scanf("%hd", &choice);       if (choice < 1 || choice > 2) printf ("Mauvais choix\n\n");  }  while ( choice < 1 || choice > 2 );    if ( choice == 1)  {       printf("Tapez le nombre de secondes :");       scanf("%ld", sec);       time(sec);  }  system("PAUSE");	  return 0;}int time(int sec){    long int min,h,new_sec;    min=0;    h=0;    min = sec / 60;    new_sec = sec % 60;    h = min / 60;    min= min % 60;    printf("Il est %dh%dmin%ds", h, min, new_sec);        return sec;}