I hate to be stupid but does this program solve the problem of testing an integer to be divisible by 6?
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Chapter7Problem5
{
class Program
{
static void Main()
{
int number;
Console.Write("\nEnter a integer: ");
number = Convert.ToInt32(Console.ReadLine());
if ((number % 2 == 0) && (number % 3 == 0))
Console.Write("\nThe number is divisible by 6!");
else
Console.Write("\nThe number is not divisible by 6!");
}
}
}