Created
September 22, 2015 18:23
-
-
Save jy95/8fca711abb021138b4c3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /* Version 2 */ | |
| int n; | |
| int main(){ | |
| int nombre; | |
| int unite; | |
| double factorielle; | |
| while((nombre=getchar()) != EOF ){ | |
| if (nombre == '\n') { | |
| printf("Ligne vide \n"); | |
| continue; | |
| } | |
| if ( nombre < '0' || nombre > '9'){ | |
| printf("Pas un chiffre \n"); | |
| while(getchar() != '\n'){ | |
| } | |
| continue; | |
| } | |
| if ((unite = getchar()) >= '0' && unite <= '9' ) { | |
| if (getchar() == '\n') { | |
| nombre=nombre-'0'; | |
| unite = unite - '0'; | |
| if (nombre >= 0 && nombre < 10 && unite >= 0 && unite < 10 ) { | |
| nombre = (nombre * 10 ) + unite; | |
| factorielle = 1; | |
| for(;nombre > 0;nombre--){ | |
| factorielle*=nombre; | |
| } | |
| printf("resultat %d \n",factorielle); | |
| continue; | |
| } | |
| while(getchar() != '\n') { | |
| } | |
| continue; | |
| } | |
| } | |
| return 0; | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment