Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- public static int EqualNums(double x, double y)
- {
- /*int num = 0;
- if (x < 0 || y < 0) return 0;
- if ((x % 10) == (y % 10))
- num++;
- return num + EqualNums(x / 10, y / 10);*/
- int num = 0;
- if (x < 10 || y < 10)
- {
- if ((x % 10) == (y % 10))
- return 1;
- }
- if ((x % 10) == (y % 10))
- num++;
- return num + EqualNums(x / 10, y / 10);
- }
- static void Main(string[] args)
- {
- Console.WriteLine(EqualNums(1234, 1234));
- Console.ReadLine();
- }
- }
Add Comment
Please, Sign In to add comment