1st Sep 2020, 7:47 AM
Prashant Pandey
Prashant Pandey - avatar
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
1st Sep 2020, 9:17 AM
Arsenic
Arsenic - avatar
+ 4
There are cases when your prime() is not returning anything which does not match with the defination of that function.
1st Sep 2020, 7:55 AM
Arsenic
Arsenic - avatar
+ 2
Where am i going wrong if i want to print prime numbers between two numbers.
1st Sep 2020, 7:56 AM
Prashant Pandey
Prashant Pandey - avatar
+ 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...
1st Sep 2020, 8:22 AM
Rupali Haldiya
Rupali Haldiya - avatar
+ 1
Thanks
1st Sep 2020, 9:21 AM
Prashant Pandey
Prashant Pandey - avatar