Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program {
- static int fun(int a) {
- int i = 2;
- while (i <= Math.Sqrt(a) && a % i != 0)
- {
- i += 1;
- }
- return Convert.ToInt32(i > Math.Sqrt(a));
- }
- static void Main(string[] args) {
- Console.Write("Введите первое число: ");
- int A = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите второе число: ");
- int B = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите третье число: ");
- int C = Convert.ToInt32(Console.ReadLine());
- int ANSWER = fun(A) + fun(B) + fun(C);
- Console.WriteLine($"Всего {ANSWER} простых числа");
- }
- }
Add Comment
Please, Sign In to add comment