#include <stdio.h>
int countCapital(char str[]);
int countMinuscule(char str[]);
int countNumber(char str[]);
int main(int argc, char *argv[]) {
char str[] = "asjdfhgkaL;JIASFHBLASHFIQijfe39ajsbdkhw3;NLhpnlkNlIhOJN";
int capital = countCapital(str);
int minuscule = countMinuscule(str);
int number = countNumber(str);
printf("Capital is %d\nMinuscule is %d\nNumber is %d\n", capital, minuscule, number);
return 0;
}
int countCapital(char str[]) {
int count = 0;
int i = 0;
while(str[i] != '\0') {
if(str[i] >= 'A' && str[i] <= 'Z')
count++;
i++;
}
return count;
}
int countMinuscule(char str[]) {
int count = 0;
int i = 0;
while(str[i] != '\0') {
if(str[i] >= 'a' && str[i] <= 'z')
count++;
i++;
}
return count;
}
int countNumber(char str[]) {
int count = 0;
int i = 0;
while(str[i] != '\0') {
if(str[i] >= '0' && str[i] <= '9')
count++;
i++;
}
return count;
} |