Follow by Email

1/27/19

c language question print the series of all prime no till N

Q-1 print  the series of all prime no till N


#include <stdio.h> int main() { int prime(int); int a; scanf("%d",&a); while(a>=2) { prime(a); a--; } return 0; } int prime(int x) { int i=2; for(i=2;i<=x-1;i++) { if(x%i==0) { return 0; } } if(x==2) { printf("%d",x); return 0; } if(i==x) { printf(" %d",x); return 0; } }
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post
 

best and cheap hosting

Delivered by FeedBurner