Charecter & space founder in c program

Charecter & space founder in c program:

#include
main()
{
    char str[80];
    printf("Enter a string: ");
    scanf("%[^\n]",str);
    int i,countAlpha=0,countSpace=0;
    for(i=0;str[i]!='\0';i++){
        if((str[i]>='A' && str[i]<='Z')||(str[i]>='a' && str[i]<='z')){
            countAlpha++;
        }
        else if(str[i]==' '){///else if(str[i]==32) =>==> (' '=32)
            countSpace++;
        }
    }
    printf("Total Alphabetic charecters found: %d\n",countAlpha);
    printf("Total Spaces charecters found: %d\n",countSpace);

}



Comments

Popular posts from this blog

For loop C++

VALENTINE DAY PROGRAME