View Code of Problem 58

#include "stdio.h"
#include "math.h"
#include "string.h"

void main()
{
	int i,count=0;
	char s[100];
	gets(s);
	for(i=0;s[i]!='\0';i++)
	{
		if(s[i]!=' '&&(s[i+1]==' '||s[i+1]=='\0'))
			count++;
	}
	printf("%d",count);
}

Double click to view unformatted code.


Back to problem 58