80. WAP to program to print prime numbers between n1 and n2
#include<stdio.h>
void
main()
{
int i,j,c,n1,n2;
printf("WAP to program to print
prime numbers between n1 and n2 \n");
printf("Enter lower limit :
");
scanf("%d",&n1);
printf("Enter upper limit :
");
scanf("%d",&n2);
for(i=n1;i<=n2;i++)
{
for(j=2,c=0;j<i;j++)
{
if(i%j==0)
c++;
}
if(c==0)
printf("%d
",i);
}
printf("\n");
}
Comments
Post a Comment