例如,我發現從2到100的素數。我需要知道哪個數字在位上讓我們說24個。你能幫我找到最簡單的方法嗎?c#如何找到範圍內的數字位置
using System;
using System.Collections.Generic;
class SomePrimesRange
{
static void Main()
{
for (int i = 2; i < 260; i++)
{
if (i % 2 == 0)
{
}
else if (i % i == 0)
{
Console.WriteLine(i);
}
List<int> numbers = new List<int>(260);
numbers.Add(i);
foreach (int a in numbers)
{
Console.WriteLine("Enter a position:");
int position = int.Parse(Console.ReadLine());
Console.WriteLine(position);
}
}
}
}
'你能不能幫我找到了最簡單的方法呢'? – Eser
嗨!我嘗試過這樣做: [http://pastebin.com/LPER5CNq]這是我到目前爲止努力的方式:( –