c program to fing a the given number is prime or not
Answers
Answered by
0
Answer:
void main(){
int ok =1,num,cnt;
printf("Enter number :");scanf("%d",&num);
cnt =2;while(cnt<=(num/2))
{if(num%cnt==0) {ok =false;break; }
cnt = cnt +1;
}if(ok==1)printf("%d is prime",num);else printf("%d is not prime",num);
}
Explanation:
Similar questions