Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.
rev | Admin | (Created page with "<syntaxhighlight lang="C"> // to compile: gcc -Wall prime.c -lm -o prime #include <math.h> // for the square root function sqrt() #include <stdio.h> int is_prime(int n); int main() { printf("Write an integer: "); int var; scanf("%d", &var); if (is_prime(var)==1) { printf("A prime\n"); } else { printf("Not a prime\n"); } return 1; } int is_prime(int n) { int x; int sq= sqrt(n)+1; // Checking the trivial cases first if ( n < 2 )...") | May 13'24 at 22:49 | +1,598 |