0% found this document useful (0 votes)
16 views2 pages

Prime Upton

Uploaded by

RAMSWAMI BANSODE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Prime Upton

Uploaded by

RAMSWAMI BANSODE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

//Print prime number up to n :

#include<stdio.h>
int main() {
int n,num,count,i;
printf("Enter the range : ");
scanf("%d", &n);
printf("The prime number in between the 2 to %d : ", n);
for(num=1; num<=n; num++)
{
count =0;
for(i=2; i<=num/2; i++)
{
if(num % i == 0)
{
count++;
break;
}

}
if(count == 0 && num != 1)
{
printf("%d ",num);
}
}
return 0;
}

You might also like