home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / dos / prg / alb_c10 / chap_05 / ch05_05.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-08  |  843 b   |  36 lines

  1. /*********************************************************************
  2. *  CH05_05.C                    Switch:  mois=>trimestre   *
  3. *********************************************************************/
  4.  
  5. #include<stdio.h>
  6.  
  7. main( void)
  8. {
  9.     int num_mois;
  10.  
  11.     printf(" Entrez le numΘro du mois: ");
  12.     scanf("%d", &num_mois);
  13.     while( getchar() != '\n');
  14.  
  15.     switch( num_mois)
  16.     {
  17.         case 1 :
  18.         case 2 :
  19.         case 3 :    printf(" Premier trimestre.");       break;
  20.         case 4 :
  21.         case 5 :
  22.         case 6 :    printf(" Second trimestre.");       break;
  23.         case 7 :
  24.         case 8 :
  25.         case 9 :    printf(" TroisiΦme trimestre.");   break;
  26.         case 10:
  27.         case 11:
  28.         case 12:    printf(" Dernier trimestre.");       break;
  29.  
  30.         default:    printf(" Erreur de saisie!");
  31.             num_mois= 0;
  32.     }
  33.     printf("\n\n\t\t *** Fin du programme ***");
  34. }
  35.  
  36.