Debut TP14
This commit is contained in:
21
DEV1.1/TP14/statistique.c
Normal file
21
DEV1.1/TP14/statistique.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
int main(void) {
|
||||
int nbr_char_e=0;
|
||||
unsigned int nbr_char;
|
||||
char texte[201];
|
||||
printf("Texte : ");
|
||||
fgets(texte,200,stdin);
|
||||
for(nbr_char=0;texte[nbr_char]!='\n';nbr_char++){
|
||||
if (texte[nbr_char]=='e')
|
||||
nbr_char_e++;
|
||||
}
|
||||
texte[201]='\0';
|
||||
nbr_char=strlen(texte);
|
||||
printf("nombre de e = %d\n",nbr_char_e);
|
||||
printf("nombre de lettre = %d\n",nbr_char);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user