home *** CD-ROM | disk | FTP | other *** search
- /*********************************************************************
- * CH05_14.C Calcul d'une factorielle quand n<13 avec des UL *
- *********************************************************************/
-
- #include<stdio.h>
- int LitInt( void); /* Prototype de la fonction que nous avons crΘΘ.*/
-
- main( void)
- {
- int n= 1, i;
- unsigned long int factorielle;
-
- while( n)
- {
- do {
- printf("\n Composez le nombre dont la "
- "factorielle est α calculer: n= ");
- n= LitInt();
- }
- while( n< 0 && n> 12);
-
- factorielle= 1;
- if( n>1)
- for( i=2; i<= n; ++i) factorielle*= i;
-
- printf("\n\t\t !%d= %lu\n", n, factorielle );
- }
- }
-
- int LitInt( void) /* DΘfinition de la fonction. */
- {
- int Entier;
- while( scanf("%d", &Entier) != 1)
- while( getchar() != '\n' );
- while( getchar() != '\n' );
- return( Entier);
- }
-