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 ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a = Convert.ToInt32(Console.ReadLine());
- int b = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine(Func(a, b));
- if(Func(a, b) == 1)
- {
- Console.WriteLine("Простое!");
- }
- else
- {
- Console.WriteLine("Не простое!!");
- }
- Console.ReadKey();
- }
- public static int Func(int k, int n)
- {
- if( k * k > n)
- {
- return 1;
- }
- if(n % k == 0)
- {
- return 0;
- }
- return Func(n, k++);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement