Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Find if number is prime - C#

DZone's Guide to

Find if number is prime - C#

· Web Dev Zone ·
Free Resource

Learn how Crafter’s Git-based content management system is reinventing modern digital experiences. Download this white paper now. 

Find if number is prime - C#public bool IsPrime(int num)

{

bool _isPrime = true;


if (num % 2 == 0) return false;


for (int i = 3; i

Crafter CMS is a modern Git-based platform for building innovative websites and content-rich digital experiences. Download this white paper now.

Topics:
c# ,webdev ,code snippet

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}