-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
33 lines (31 loc) · 856 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
namespace Project_2
{
class Program
{
static void Main(string[] args)
{
int x;
int sum = 0;
Console.WriteLine("Please enter the start");
int start = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter the End");
int end = int.Parse(Console.ReadLine());
for (x = start; x <= end; x++)
{
for (int j = 1; j < x; j++)
{
if (x % j == 0)
{
sum += j;
}
}
if (sum == x)
{
Console.WriteLine("Perfect numbers are: " + sum);
}
sum = 0;
}
}
}
}