Preview:
using System;
class Program {
    static void Main() {
        Console.Write("Enter a number: ");
        int n = int.Parse(Console.ReadLine());
        bool isPrime = n > 1;
        for(int i = 2; i <= Math.Sqrt(n); i++) {
            if(n % i == 0) {
                isPrime = false; break;
            }
        }
        Console.WriteLine(isPrime ? "Prime" : "Not prime");
    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter