+ 1
5 Réponses
+ 1
Although rupali ' s method is much more optimal but if you want to fix this one you can do it like this👇
https://code.sololearn.com/cfCWkdOtbA0k/?ref=app
+ 4
There are cases when your prime() is not returning anything which does not match with the defination of that function.
+ 2
Where am i going wrong
if i want to print prime numbers between two numbers.
+ 1
I think error in your if condition,
But if you want only print prime numbers , you can use this,
#include <stdio.h>
int main() {
int a,b;
printf ("Enter two numbers\n");
scanf("%d %d",&a,&b);
for(int i = a;i <= b;i++){
if(i % 2 != 0){
printf("%d\n",i);
}
}
return 0;
}
Too easy...
+ 1
Thanks