KalkulatorISP-31rrrrr/source/repos/ConsoleApp15/Program.cs
2025-11-11 14:18:33 +04:00

96 lines
2.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Drawing;
using System.Reflection.Metadata;
namespace ConsoleApp15
{
internal class Program
{
static void Main(string[] args)
{
/** Дано натуральное число.
а) Получить все его делители.
б) Найти сумму его делителей.
в) Найти сумму его четных делителей.
г) Определить количество его делителей.
д) Определить количество его нечетных делителей.
е) Определить количество его делителей. Сколько из них четных?
ж) Найти количество его делителей, больших d.
*/
Console.WriteLine("Введите натуральное число:");
int n = Convert.ToInt32(Console.ReadLine());
int size = 0;
int[] arrayn1 = new int[size];
int index = 0;
int[] a(int n1)
{
for (int i = 1; i <= n1;i++)
{
if (n1 % i == 0)
{
size++;
}
}
Console.WriteLine("Все делители числа n:");
for (int f = 1; f <= n1; f++)
{
if (n1 % f == 0)
{
Console.Write(f + " ");
for (int i = 0; i < size; i++)
{
arrayn1[i] = f;
}
}
}
return arrayn1;
}
a(n);
void a2(int[] arrm2)
{
int summ = 0;
for (int i = 0; i < arrm2.Length; i++)
{
arrm2[i] += summ;
}
Console.Write(summ);
}
a2(arrayn1);
}
}
}