Wisdom Materials
Home
About Us
Our Clients
Careers
Services
Education
Jobs
News
Business
Health
Astrology
Entertainment
RealEstate
Devotion
Contact Us
C Programs
/ Generate Prime Numbers between 1 and n C Program
Program
Copy text
#include
void main () { int n, temp, j, i=1; printf("Enter n value: "); scanf("%d",&n); while(i<=n) { temp=0; for(j=1;j<=i;j++) if(i%j==0) temp++; if(temp==2) printf("%d", i); i++; } }
Input
Enter n value: 10
Output
2 3 5 7
Home
Back