Bhuvan InfoTech Android App

Download our Android App and browse Technical News, Projects, Computer Tricks more easily with lots of Interesting Features.

Tuesday, June 14, 2016

Check number is prime or not | C program

#include<stdio.h>
int main(){
int no,i,count=0;
printf("Enter a number: ");
scanf("%d",&no);
for(i=2;i<=no/2;i++){
if(no%i==0){
count++;
break;
}
}
if(count==0 && no!= 1)
printf("%d is a prime number",no);
else
printf("%d is not a prime number",no);
return 0;
}
Bhuvan Arora

No comments:

Amazing Deal !