63 179
Assignments Done
99,3%
Successfully Done
In July 2018

Answer to Question #14764 in C# for Miths

Question #14764
A program to identify whether the number entered by a user is even or odd?
Expert's answer
using System;
using System.Collections.Generic;
using
System.Linq;
using System.Text;

namespace EvenOdd
{
class
Program
{
static void Main(string[] args)
{
int
number;
Console.Write("Enter number: ");
number =
int.Parse(Console.ReadLine());
if (IsOdd(number))
{
Console.WriteLine("Enter number is Odd. ");
}
if
(IsEven(number))
{
Console.WriteLine("Enter number is
Even.");
}
Console.WriteLine("Press any key to
exit....");
Console.ReadLine();
}
static bool IsOdd(int
value)
{
return value % 2 != 0;
}
static bool IsEven(int
value)
{
return value % 2 == 0;
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions