Respuesta :
Answer:
The program statement will be written using Microsoft Visual C# Console
string val,vall;
Console.Write("Enter Sentence :");
vall = Console.ReadLine();
val = vall.ToUpper();
string[] words = val.Split(' ');
string[] word = new string[words.Length];
int kount = 0;
string newword = string.Empty;
for (int i = 0; i < words.Length; i++)
{
if (words[i].Length > 1)
{
char[] ch = words[i].ToCharArray();
for (int j = 1; j < words[i].ToCharArray().Length; j++)
{
newword += ch[j];
}
newword += ch[0] + "AY ";
word[kount] = newword;
kount++;
}
else
{
newword += words[i] + "AY ";
kount++;
}
}
Console.WriteLine(newword);
Console.ReadLine();
Explanation:
The first line declares two variables of string data-type
Line 2 prints "Enter Sentence" without the quotes
Line 3 accepts the sentence to be converted to Latin
Line 4 converts the sentence to uppercase
Line 5 splits the sentence word by word
Line 6 creates an array variable
Line 7 creates and initialise a variable kount to 0
Line 8 creates another variable newword,this variable would be used as output variable
Line 9 creates an iterative process
Line 11 checks if the length of a particular word in the sentence is a greater than one
If yes,
Line 13 to 20 Moves the first letter to the last then appends AY then saved in newword variable
If no,
Line 24 - 25 appends AY directly to the word currently in the iteration then saved in newword variable
Line 28 prints the Latin word equivalent of the input sentence.