Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static int div()
- {
- Console.Write("Введите a=");
- int a = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите b=");
- int b = Convert.ToInt32(Console.ReadLine());
- double sqr1 = b / 2;
- int sum = 0;
- for (int j = a; j <= b; j++)
- if (b > 1 && b % 2 == 0)
- {
- sum = Convert.ToInt32(b) + 1;
- for (int i = 2; i <= sqr1; ++i)
- {
- if (b % i == 0)
- {
- sum += i;
- }
- }
- }
- else b--;
- return sum ;
- }
- static void Main(string[] args)
- {
- Console.WriteLine("Из промежутка от a до b,максимальная сумма делителей {0}",div());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement