import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
toh(n,“T1”,“T2”,“T3”);
double result=Math.pow(2,n)-1;
System.out.println(result);
}
public static void toh(int n,String src,String dest,String helper){
if(n==0){return;}
toh(n-1,src,helper,dest);
System.out.println("Move "+n+"th disc from “+src+” to "+dest);
toh(n-1,helper,dest,src);
}
}
The output is coming in decimal how to change it to non decimal
Bro when you are typecasting it explicitly by int then why are you putting it in double? Take int!
If ya doubt is resolved mark it resolved and rate!