Prime number Logic to check it in C program
This program use to check given number is Prime no or not. As prime number not divisible by any number except by itself and one./* Program For Prime No*/ #include<stdio.h> int main() { int no,i=2; printf("\nEnter no\n"); scanf("%d",&no); int a=1; while(i<=no/2) { if(no%i==0) a=0; i++; } if(a==1) printf("No %d is Prime No...!\n",no); else printf("No %d is Not a Prime No....!\n",no); return 0; }
0 comments:
Post a Comment