What is the correction needed for this program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
8th Sep 2018, 5:36 AM
Jinyoongisaranghe
Jinyoongisaranghe - avatar
2 Answers
+ 3
Hello, can you explain what you want the code to do? So far I noticed error due to line 25 where add method was invoked, it should be add(p) instead of add(int p). And in "add" method, line 8, you are using modulo operator on a float type, and furthermore assigning the remainder from modulo operation to an int type, which triggers error: int d=n%10; I guess modulo operator isn't compatible with floating point numbers (cmiiw). (EDIT) Java actually supports modulo operation on floating points types.
8th Sep 2018, 6:08 AM
Ipang
+ 3
I'm doing the voodoo prime on coding challenge in the learn box. I understood the error in line 25 . line 8: but in the voodoo challenge its the a long value of the decimal is required to fulfill that challenge. is there any other way in which i can extract the last numbers one by one and use the if method?? thanks for solving the doubts
8th Sep 2018, 8:04 AM
Jinyoongisaranghe
Jinyoongisaranghe - avatar