TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Seshadri M
NA
69
17.7k
Extension methods implemented for odd or even number
Oct 9 2017 9:49 PM
//I have try this code but i am not getting relevant output
//if enter even number i am gettting output as odd number
static class numbers {
public static string iseven(this int i)
{
if (i / 2 == 0)
{
return "Even number";
}
return "odd number";
}
}
class Program
{
static void Main(string[] args)
{
int r = Convert.ToInt32(Console.ReadLine());
string s = r.iseven();
Console.WriteLine(s);
Console.ReadLine();
}
}
}
Reply
Answers (
2
)
How to change button color of form1 by using button of form2
How to change button color of form1 by clicking form2 button