using System;
class Program
{
public static void Main()
{
try
{
Console.WriteLine("Enter any number : ");
int number = Convert.ToInt32(Console.ReadLine());
int remainder = number % 2;
int checkNumber = number / remainder;
// if remainder is not zero than this statement will execute other wise program control goes to catch block bcoz divide by zero exception would be occured
Console.WriteLine("Number is Odd");
Console.ReadKey();
}
catch (Exception ex)
{
Console.WriteLine("Number is even");
Console.ReadKey();
}
}
}
To implement same concept in Java Click Here
That’s it!!…..Happy Programming...
Can u evaluate this program by using threads??
ReplyDeletei will try for it...
ReplyDeletei really need for it.Thnk u
ReplyDeletenyc thinking
ReplyDelete