Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# Loop Example

bool isPrime = false;
int number = 2;
while (number <= 100)
{
    isPrime = true;
    for (int i = 2; i < number; ++i)
    {
        if (number % i == 0)
        {
            isPrime = false;
            break;
        }
    }
    if (isPrime)
    {
        Console.Write(number);
        Console.Write(" ");
    }
    number++;
}
Source by webmaster.org.il #
 
PREVIOUS NEXT
Tagged: #Loop #Example
ADD COMMENT
Topic
Name
2+4 =