#include<stdio.h> #include<conio.h> void main() { int i,n,count; i=1; count=0; clrscr(); printf("enter the value of n"); scanf("%d",&n); while(i<=n) { if(n%i==0) { count=count+1; i=i+1; } else i=i+1; } if(count==2) { printf("its a prime:%d",n); } else printf("its not a prime number:%d",n); getch(); }
C Program To Know The Number is prime or not
January 02, 2015
By:
Bhanu Namikaze
Bhanu Namikaze
Bhanu Namikaze is an Ethical Hacker, Security Analyst, Blogger, Web Developer and a Mechanical Engineer. He Enjoys writing articles, Blogging, Debugging Errors and Capture the Flags. Enjoy Learning; There is Nothing Like Absolute Defeat - Try and try until you Succeed.
No comments:
Post a Comment