#include <stdio.h>
int main() {
int n;
printf("enter the number : ");
scanf("%d",&n);
int isPrime=1;
for(int i=2; i<sqrt(n); i++){
if(n%i==0){
isPrime=0;
}
}
if(isPrime){
printf("prime");
}
else{
printf("not prime");
}
return 0;
}
Preview:
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