task : debug the prime number logic

#include <stdio.h>
#include <math.h>
void main(){
 
int x,n=0,i;
scanf("%d",&x);


for(i=0;i<(int)sqrt(x);i++){
    if(x%i==0){
    n=1;
    break;
    }
   
}



if(n==1) printf("not");
else printf("PRIME");

}




Comments

Popular posts from this blog

aaabb to32 ,aabbb to a2b3 convert in c-asr

a2b3 output aabbb c program and beautiful use of getchar() ,isdigit() ,atoi() functions and stdlib.h header file-asr

C program to print square spiral number pattern - asr