22 lines
475 B
C
22 lines
475 B
C
|
#include<stdio.h>
|
||
|
|
||
|
int main(int argc, char *argv[]) {
|
||
|
int number;
|
||
|
int dividers = 0, i = 1;
|
||
|
printf("Enter number: ");
|
||
|
scanf("%d", &number);
|
||
|
while (i <= number) {
|
||
|
if (number++ % i == 0) {
|
||
|
dividers++;
|
||
|
} else {
|
||
|
continue;
|
||
|
}
|
||
|
if (dividers == 3)
|
||
|
break;
|
||
|
}
|
||
|
printf("Number %d is%s prime",
|
||
|
number,
|
||
|
(dividers == 2) ? "" : " not"
|
||
|
);
|
||
|
}
|