Created
November 4, 2015 01:13
-
-
Save abatilo/be444cbd5174589d2bd2 to your computer and use it in GitHub Desktop.
4Francesca
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class Test | |
{ | |
private static bool IsPrime(int num) | |
{ | |
if (num == 0 || num == 1) return false; | |
if (num == 2) return true; | |
for (int i = 2; i < num; ++i) { | |
if (num % i == 0) return false; | |
} | |
return true; | |
} | |
public static void Main() | |
{ | |
for (int i = 1; i <= 10; ++i) | |
{ | |
Console.WriteLine("{0}: {1}", i, IsPrime(i)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment