-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnagramExample.cs
38 lines (33 loc) · 952 Bytes
/
AnagramExample.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1.DemoA
{
class AnagramExample
{
class Anagram
{
static void Main(string[] args)
{
Console.WriteLine("Fist Word");
string s = Console.ReadLine();
char[] ch = s.ToCharArray();
Console.WriteLine("Second Word");
string s1 = Console.ReadLine();
char[] ch1 = s1.ToCharArray();
Array.Sort(ch);
Array.Sort(ch1);
string n1 = new string(ch);
string n2 = new string(ch1);
if(n1 == n2){
Console.WriteLine("it is anagram");
}else
{
Console.WriteLine("not anagram");
}
}
}
}
}