View Code of Problem 58

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

Double click to view unformatted code.


Back to problem 58