Advertisement
LePetitGlacon

FICHE 6 Exercice 8

Nov 18th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2.  
  3. namespace o
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.            
  10.             Console.WriteLine("texte :");
  11.             string texte = Console.ReadLine();
  12.             char[] tabChar = texte.ToCharArray();
  13.            
  14.             string rep = "";
  15.            
  16.            for (int i = tabChar.Length ;i != 0;i--) {
  17.                 Console.Write(tabChar[i-1]);
  18.                 rep = rep + tabChar[i-1];
  19.           }
  20.             if (rep == texte){
  21.                 Console.WriteLine("\nC UN PALINDROME");
  22.             }
  23.             else{
  24.                 Console.WriteLine("\nCe n'est pas un palindrome");
  25.             }
  26.             Console.ReadKey();
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement