Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Лабораторная2
- {
- class Program
- {
- public static int Euler (int n)
- {
- int res = n;
- for (int i = 2; i*i < n; i++ )
- {
- if (n % i == 0)
- {
- while (n % i == 0)
- {
- n /= i;
- }
- res -= res / i;
- }
- }
- if (n > 1)
- {
- res -= res / n;
- }
- return res;
- }
- static void Main(string[] args)
- {
- Console.WriteLine("Пожалуйста, введите число: ");
- int num = int.Parse(Console.ReadLine());
- int res = 0;
- res = Euler(num);
- Console.WriteLine($"Ответ: {res}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement