Skip to main content
Search
Search This Blog
Livecodo
Pages
Home
Courses
Blog
About us
More…
Share
Get link
Facebook
X
Pinterest
Email
Other Apps
March 28, 2024
Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user.
#include
#include
int main() { int a=1,b,n,count=2; printf("Enter the last number of the interval: "); scanf("%d",&b); printf("prime number between 1 and %d is\n ",b); for(n=1;n<=b;n++) { if(n%count!=0) printf("%d\n",n); } return 0; }
Popular Posts
March 26, 2024
Dynamic Memory allocation in C
May 18, 2024
Searching and sorting Algorithm in C