Write a C# Sharp program to check if it is possible to add two integers to get the third integer from three given integers

  • برمجة سي شارب
  • برمجة

Write a C# Sharp program to check if it is possible to add two integers to get the third integer from three given integers

Sample Output:

True
False
True

الأجوبة

using System;
using System.Linq;
namespace exercises
{
   class Program
    {       
        static void Main(string[] args)
        {
            Console.WriteLine(test(1, 2, 3));
            Console.WriteLine(test(4, 5, 6));
            Console.WriteLine(test(-1, 1, 0));
            Console.ReadLine();
        }
        public static bool test(int x, int y, int z)
        {
             return x == y + z || y == x + z || z == x + y;
        }
    }
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...