Write a C# Sharp program to check two given integers, each in the range 10..99. Return true if a digit appears in both numbers, such as the 3 in 13 and 33
- برمجة سي شارب
- برمجة
- 2021-05-16
- MarwaMohammed
الأجوبة
using System;
using System.Linq;
namespace exercises
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(test(11, 21));
Console.WriteLine(test(11, 20));
Console.WriteLine(test(10, 10));
Console.ReadLine();
}
public static bool test(int x, int y)
{
return x / 10 == y / 10 || x / 10 == y % 10 || x % 10 == y / 10 || x % 10 == y % 10;
}
}
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
