Santhosh
Find Prime numbers in a given range using arrays
By Santhosh in .NET on Jul 27 2016
  • Santhosh
    Jul, 2016 27

    public void BasicsOfArray(){Console.WriteLine("Enter Min range");int MinRange = Convert.ToInt32(Console.ReadLine());Console.WriteLine();Console.WriteLine("Enter Max range");int MaxRange = Convert.ToInt32(Console.ReadLine());int[] arr6 = new int[MaxRange];int Count = 0;Console.WriteLine("Prime number.");for (int i = MinRange; i < MaxRange; i++){for (int j = 1; j < MaxRange; j++){if (i % j == 0){Count++;}}if (Count == 2){arr6[Index] = i;Console.Write(arr6[Index] + " ");}Count = 0;}Console.ReadLine();}

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS