View Code of Problem 58

#include <stdio.h>
#include <string.h>
#include <math.h>
#define N 100
int main()
{
	char a[N];
	int i, k = 0,w;
	gets(a);
	for (i = 0; i < N; i++)
	{
		if (a[i] == ' ')
			w=0;
		else
		{
			if (w == 0)
			{
				k++;
				w = 1;
			}
		}
	}
	printf("%d", k);

}

Double click to view unformatted code.


Back to problem 58