Post Top Ad

Your Ad Spot

Pages

Saturday, 8 February 2020

Write a Program display Prime Number A To B

 #include<stdio.h>
#include<conio.h>
// NO IS PRIME OR NOT
int Isprime(int no)
{
int i;
for(i=2;i<=no/2;i++)
{
if(no%i==0)
return 0;
}
return 1;
}

void AToBPrime(int a,int b)
{
int i;
int count=0;

for(i=a;i<=b;i++)
{

if(Isprime(i))
{  
printf(" %d",i);
    }
}

}
void main()

   
   AToBPrime(5,10);
}

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages