Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- public class Program
- {
- public static void Main(string[] args)
- {
- HashSet<int>normalNumbers=new HashSet<int>();
- StringBuilder sb=new StringBuilder();
- for(int i=10;i<100;i++)
- {
- for(int j=10;j<100;j++)
- {
- int m=i;
- int n=j;
- char[]reverseTwo=n.ToString().ToCharArray();
- Array.Reverse(reverseTwo);
- string getIntTwo=string.Concat(reverseTwo);
- char[]reverse=m.ToString().ToCharArray();
- Array.Reverse(reverse);
- string getInt=string.Concat(reverse);
- int b=int.Parse(getInt);
- int a=int.Parse(getIntTwo);
- int mXnResult=m*n;
- int aXbResult=a*b;
- bool Even=mXnResult==aXbResult;
- if(Even)
- {
- normalNumbers.Add(n);
- normalNumbers.Add(m);
- normalNumbers.Add(a);
- normalNumbers.Add(b);
- string evenPairs=string.Format("{0}*{1}={2}*{3} ={4}",n,m,a,b,aXbResult);
- sb.AppendLine(evenPairs);
- }
- }
- }
- Console.WriteLine(string.Join(" ",normalNumbers.OrderBy(x=>x)));
- Console.WriteLine();
- Console.WriteLine(sb.ToString().TrimEnd());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement