0
prime number between a range no output is showing
#include<stdio.h> void main() { int a,b,i,j,count=0; printf("enter any range to find prime number between it"); scanf("%d %d",&a,&b); for(i=a;i<=b;i++) { for(j=2;j<=i/2;j++) { if(i%j==0) { count++; } } if(count==0) { printf("%d",i); } } }
1 Antwort
+ 1
you need to reset count back to 0 at the start of every iteration of the outer-loop 😄