Untitled - MARKUP 0.77 KB
                                
                                    namespace Rekurencja
{
    internal class Program
    {

        static int czyPierwsza(int a, int i)
        {
            if (a%i == 0 && a>i)
            {
                return czyPierwsza(a, i + 1);
            }
            else
            {
                if (a == i)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            
        } 

        static void Main(string[] args)
        {
            Console.WriteLine("Podaj liczbe: ");
            int liczba = Convert.ToInt32(Console.ReadLine());
            int i = 2;


            czyPierwsza(liczba, i);

        }
    }
}
                                
                            

Paste Hosted With By Wklejamy.pl