#include<stdio.h> #include<conio.h> void main() { int m,n,i,c; clrscr(); printf("enter first limit: "); scanf("%d",&m); printf("enter last limit: "); scanf("%d",&n); printf("\nPrime numbers upto %d\n",n); while(m<=n) { i=1; c=0; while(i<=m) { if(m%i==0) { c++; } i++; } if(c==2) printf("%d\n",m); m++; } getch(); }
C Program To Find Prime numbers in given range
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