blob: 0e2788207d59b104ab98d8b5486185a32402c960 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "occurrences.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
void occurrences(char * phrase)
{
int characters = 0;
int digits = 0;
int vowels = 0;
char c;
while ((c = *phrase++) != '\0')
{
characters++;
if (isdigit(c))
{
digits++;
}
else if (strchr("aeiouAEIOU", c) != NULL)
{
vowels++;
}
}
printf("The number of characters is %d, the number of digits is %d, and the number of vowels is %d\n", characters, digits, vowels);
}
|