Macrovision

Balanced Parentheses_3

Jun 23rd, 2022 (edited)
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1.  /*Balanced Parentheses_3*/
  2.    Console.WriteLine(" try it me ");
  3. while (true)
  4. {
  5.     Console.WriteLine(" try it agan ");
  6.     char[] Text = Console.ReadLine().ToCharArray();
  7.     string Pharentesis = (Text[0].Equals('(') && Text[1].Equals(')')) ? ":) yes" : ":( No";
  8.     string Corchetes = (Text[0].Equals('[') && Text[1].Equals(']'))   ? ":) yes" : ":( No";
  9.     string Brackets = (Text[0].Equals('{') && Text[1].Equals('}'))    ? ":) yes" : ":( No";
  10.     Console.WriteLine("\n() "+ Pharentesis+"\n[] "+ Corchetes+"\n{} "+ Brackets+"\n");  
  11. }
Add Comment
Please, Sign In to add comment