Programme to find the longest word in the sentence
This program is made to find the longest word in the sentence.We add space to the input sentence and measure the length of the sentence.After that we run the loop and extract the word,then we measure the length of the word extract.Then the loop is run again and the new word is extract then it will compare together and it will assign the longest one to p and the length of the longest word to n.
Here we see that the input sentence is"Arun want to study java".Hence the longest word is (study) and length of the longest word is(5).
Comments
Post a Comment