0
what are the errors in this given code ?
public class practice1 { public static void main (String []asr){ Scanner s=new Scanner(System.in); int x=s.nextInt(),cube=0,unit=0; cube=x*x*x; practice1.method1(cube); public int method1(int a){ if(a%10<10) { if((a%10)==(method2(x))) //Is x not a global variable ? { return a; } else{ System.out.println("Not that no"); } } else { int cube = a%10; method1(cube); } public int method2(int s){ if(s%10<10) { return s%10; } else { int no=s%10; method2(no); } } }
2 Answers
+ 2
I noticed you use Scanner but didn't have "import java.util.Scanner;" other than that missing curly brackets, and method1 & method2 being non-static. What do you want to do with this code? are you attempting the trimorphic number challenge? (I see you use cube). Provide more information please.
+ 1
Ipang yes, you are right.
Iâm trying to attempt trimorphic challenge.
I resolved the errors now !but still getting issues in return in methods !!?
Iâll share the code again