Q:

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

0

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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;
        }
    }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now