Please reply asap Write a C PROGRAM not c that prompts the u
Please reply asap Write a C PROGRAM, not c++ that prompts the user to enter a noun of no more than 25 characters. The program should create a new string that is the plural of the noun. Use the following rules when creating plurals: 1. If a noun ends in \'s\', \'ch\', or \'sh\' add es to the noun 2. If a noun ends in \'y\', change the \'y\' to \'i\' and add \'es\' to the noun. 3. In all other cases add an \'s\' to the noun. Your program should print the noun as entered by the user and then print the plural. Use a function to create the plural. The function may print the plural if you wish.
Solution
#include <stdio.h>
#include <string.h>
#define max_word 20
/* prototypes */
void pluralize (char word[]);
int main (void)
{
char noun[max_word]; /* stores temporary word entered by user */
printf(\"Enter a noun in singular form: \");
scanf(\"%s\", noun);
while (strcmp(noun, \"done\") != 0)
{
pluralize (noun);
printf(\"The plural form is %s\ \", noun);
}
return;
}
void pluralize (char word[])
{
int length;
char noun;
length=1;
length = strlen(word);
if (word[length - 1] == \'y\')
{ word[length - 1] = \'i\';
word[length] = \'e\';
word[length + 1] = \'s\';
word[length + 2] = \'\\0\';
}
/* if word ends in \"s\" \"ch\" or \"sh\" add \"es\" */
else if (word[length - 1] == \'s\' ||
(word[length - 2] == \'c\' && word[length - 1] == \'h\') ||
(word[length - 2] == \'s\' && word[length - 1] == \'h\'))
{ strcat(word, \"es\");
}
else
{ strcat(word, \"s\");
printf(\"New word is: \", &noun);
}
return;
}

