#include <stdio.h> int main() { char str[100],sav[100],tmp[100]; int i,count=0,k=0,len,flag,a[10]; printf("Enter string:"); gets(str); printf("\nYou entered:"); puts(str); printf("\n"); len=strlen(str); while(1) { for(i=0;str[i]!='\0';i++) { count++; sav[i]=str[i]; if(str[i] == ' ' || str[i] !='\0') { if(k<count)> { printf("No. of words is:%d\n",count); k=count; printf("Words separated by spaces:"); puts(sav); printf("\n"); } count = 0; } } } return 0; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)