public static void main()
{
String s = Console.ReadLine();
int len = s.length();
Char startletter = s[0];
Char endletter = s[len-1];
string midletter = ‘’;
if(len % 2 ==0)
midletter = s[len/2] + s[(len/2) +1]
else
midletter = s[len/2];
Console.WriteLine(startletter + midletter + endletter);
}
Here the logic is that, startletter is obtained using the index ‘0’, the last letter is obtained by calculating the “length of the string” and subtract 1 to get the “last index” of the given string.
Middle letter is calculated by first finding whether the given string length is “odd or even” and based on that index(es) are identified.
There is not a question but I will say thanks, because I learned something!!! lucky me I don't have to worry because I am allergic to alcohol and tabacco
Answer:
The algorithm to find A is even or odd.
- input A.
- Check the remainder on diving by 2 by A%2.
- If remainder is 1 then A is odd Print(Odd).
- If remainder is 0 print(Even).
Explanation:
To check if the number is even or odd we use modulo operator(%).Which gives the remainder on dividing.So if we do this A%2 it will give the remainder that will come out on dividing the value of A by 2.
So if the remainder comes out is 1 then the number is odd and if the remainder is 0 then the number is odd.
Some of them do let you draw funds but not all debit cards