Enter your email address:


Monday, September 2, 2013

Home » , » WAP to find out the longest word in a string.

WAP to find out the longest word in a string.

Questions: Top-30-c-programs-asked-in-interview_6304.html

24. WAP to find out the longest word in a string.
#include
#include
#include
void main()
{
int i,max=0,co unt=0,j;
char str[100]; / * ={"INDIA IS DEMOCRATIC COUNTRY"}; u can use a string inside,in place of user input */

printf("\n Enter the string\n:" );
gets(str);

for(i=0;i
{
if(!(str[i ]==32))
{
count++;
}
else
{

if(max
{
j=i-count;
max=count;
}
count=0;
}
}
for(i=j;i
printf("%c ",str[i]);
getch();
}

Share this games :

0 comments:

Post a Comment

Related Posts