Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is wrong with my program? Thanks. Your job is to find the length of the longest word in a text with no punctuation or

image text in transcribedimage text in transcribedWhat is wrong with my program?

Thanks.

Your job is to find the length of the longest word in a text with no punctuation or special characters of any kind - only contains words. To do so, please write a C-program that takes as a input first the number of words in a text, followed by all of the words in the text. The output of your program should be the length of the longest word in the text. To simplify your program, you can assume that the longest word will not exceed 100 characters. Examples Input: 14 This is a simple example text we have to find the largest word length Output: 7 Input: 7 All cats are grey in the dark Output: 4 Warning: You will be graded on your output, so do not include any print statements that prompt a user for input. Note You may submit as many solutions as you wish. Only your highest score will be kept. STATEMENT SOLVE HINTS Codel x + 1 #include 2 - int main(void){ 3 int number = 0; 4 int i = 0, n = 0; 5 int largest_length = 0; 6 int current_length = 0; 7 char word [100]; 8 scanf("%d", &number); 9- for(i = 0; i largest_length) { 15 largest_length = current_length; 16 } 17 18 printf("%d", largest_length); 19 return 0; 20 } Submit answer Score : 0% X Submitted on 1/3/22 7:04 PM Tests passed: 0/2 X Test #1 Wrong answer in 0 s

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions

Question

Experience with SharePoint and/or Microsoft Project desirable

Answered: 1 week ago

Question

Knowledge of process documentation (process flow charting)

Answered: 1 week ago