View Code of Problem 58

#include <stdio.h>
int main()
{
	int i;
	int word=0;
	int num=0;
	char string[81];
	char c;
	gets(string);
	for(i=0;(c=string[i])!='\0';i++)
		if(c==' ')
			word=0;
		else if(word==0)
		{
			word=1;
		    num++;
		}
		printf("%d",num);
	return 0;
}

Double click to view unformatted code.


Back to problem 58