answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<string.h>

#include<conio.h>

void main()

{

int i,max=0,count=0,j;

char str[100]; /* ={"India IS DEMOCRATIC COUNTRY"}; u can use a string inside,in place of user input */

printf("\nEnter the string\n:");

gets(str);

for(i=0;i<strlen(str);i++)

{

if(!(str[i]==32))

{

count++;

}

else

{

if(max<count)

{

j=i-count;

max=count;

}

count=0;

}

}

for(i=j;i<(j+max);i++)

printf("%c",str[i]);

getch();

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to find largest word in a string?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write a c program to find a word in a string?

what is if(!(str[i]==32))


How do you write a c program to find the smallest word in a string?

what is if(!(str[i]==32))


C program to find the largest and smallest character in a word?

helicopter


Write a Java Program to find occurences of given word in a text?

Check the documentation of the String class, for a method that searches for a substring.


Write a PHP program to check whether the string is palindrome or not?

You can do this: &lt;?php if ( $word === strrev( $word ) ) { echo "The word is a palindrome"; } else { echo "The word is not a palindrome"; }


How to write Java program for find longest word in a string?

class LongestWord{String str = "Ram is intelligent boy";String stringArray[] = str.split("\\s");public String compare(String st1, String st2){if(st1.length()>st2.length()){return st1;}else{return st2;}}LongestWord(){String word = "";for(int i=0;i


Is the word largest a common noun?

No, the word 'largest' is an adjective; the superlative form for the adjective large:largelargerlargestExample: We bought the largest melon we could find.


What phrase begins with the word string?

String him along is a saying. It begins with the word string.


Write a c program to count the number of word in a string?

#include&lt;stdio.h&gt; void main() { int cnt=0,i; char str[100]; printf("Enter the string "); scanf("%s",str); for(i=0;i&lt;strlen(str)-1;i++) { if(str[i]==' ') cnt++; } printf("\nTotal no. of word in string = %d",cnt); }


Bluej program-read a string and check if the given string is a palindrome?

import java.util.Scanner; public class Palindrome{ public static void main(String[] args){ String front; String back =""; char[] failure; String backwards; Scanner input=new Scanner(System.in); System.out.print("Enter a word: "); front=input.next(); front=front.replaceAll(" ", ""); failure=front.toCharArray(); for (int i=0; i&lt;failure.length; i++){ back=failure[i] + back; } if (front.equals(back)){ System.out.print("That word is a palindrome"); }else System.out.print("That word is not a palindrome"); }}


Program to select word from a sentence?

Microsoft Word will find specific words.


Program for palindrome in php?

You could use a function like this:function isPalindrome($string) {$string = strtolower($string);return (strrev($string) == $string) ? true : false;}and then to check a palindrome call an if statement like so:if(isPalindrome($test)) {echo $test.' is a palindrome';}else {echo $test.' is not a palindrome';}