Write a C# Sharp program to test if a given non-negative number is a multiple of 13 or it is one more than a multiple of 13

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

Write a C# Sharp program to test if a given non-negative number is a multiple of 13 or it is one more than a multiple of 13

Sample Output:

True
True
True
False

الأجوبة

using System;
using System.Linq;
namespace exercises
{
   class Program
    {   
        static void Main(string[] args)
        {
            Console.WriteLine(test(13));
            Console.WriteLine(test(14));
            Console.WriteLine(test(27));
            Console.WriteLine(test(41));
            Console.ReadLine();
        }
         public static bool test(int n)
        {
            return n % 13 == 0 || n % 13 == 1;
        }
    }
}
هل كان المحتوى مفيد؟

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

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