#include <stdio.h>
#include <string.h>
#include <ctype.h>

#define LENGTH 100

void getInput(char *arr);

int main() {
    char buff[LENGTH];
    int numbLetters = 0;
    int numbDigits = 0;
    int numbPunct = 0;

    getInput(buff);

    int i = 0;
    while(buff[i]){
        if(isalpha(buff[i]))
            ++numbLetters;
        else if(isdigit(buff[i]))
            ++numbDigits;
        else if(ispunct(buff[i]))
            ++numbPunct;
        ++i;
    }

    printf("\"%s\" contains %d letters, %d digits and %d punctuation characters.\n", buff, numbLetters, numbDigits, numbPunct);
    return 0;
}

void getInput(char *arr){
    //-1 for NULL terminator
    printf("enter a sentence less than %d characters:\n", LENGTH -1);
    fgets(arr, LENGTH, stdin);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: