Prime Number Program in C – Check if a Number is Prime

A prime number program in C checks whether a given integer is prime — divisible only by 1 and itself. Numbers like 2, 3, 5, 7, 11, and 13 are prime; 4, 6, 9, and 12 are not. This page covers two approaches: a basic trial division and an optimized version that skips even numbers, …