View Code of Problem 58

#include<stdio.h>
#include<string.h>
void main()
{
    char str[100];
    int n=0, i=0, isAlpha = 0;
    gets(str);
    while(str[i]!='\0')
    {
        if(str[i] != ' ')
        {
            if(isAlpha == 0)
            {
                n++;
                isAlpha = 1;
            }
        }
        else
        {
            isAlpha = 0;
        }
        i++;
    }
    printf("%d", n);
}

Double click to view unformatted code.


Back to problem 58