fork download
  1. using static System.Console;
  2.  
  3. public class Program {
  4. public static void Main() {
  5. WriteLine(EhPalindromo("4004"));
  6. WriteLine(EhPalindromo("4002"));
  7. }
  8. public static bool EhPalindromo(string texto) {
  9. for (int i = texto.Length - 1; i > texto.Length / 2; i--) {
  10. if (texto[i] != texto[texto.Length - i - 1]) {
  11. return false;
  12. }
  13. }
  14. return true;
  15. }
  16. }
  17.  
  18. //https://pt.stackoverflow.com/q/85688/101
Success #stdin #stdout 0.02s 15864KB
stdin
Standard input is empty
stdout
True
False