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
jkjsha ahsa
NA
24
26.1k
there is error
Nov 6 2009 11:48 AM
here i want to make program get the perfect number
and there is a syntax error
i want to know
static void Main(string[] args)
{
Console.WriteLine("enter ");
int x = int.Parse(Console.ReadLine());
bool p = perfect(x);
if (p == true)
Console.WriteLine("perfect");
else
Console.WriteLine("not perfect");
}
static bool perfect(int x)
{
int sum = 0;
for (int i = 0; i <= x; i++)
{
sum += i;
if (sum == x)
return true;
else
if (sum > x)
return false;
}
}
the error
Reply
Answers (
1
)
C# "desktop icon"(object) drag and drop
Get value from object