+ 1
What's wrong with this code?
Here's the code:import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int inpu=NextInt(); int shin=NextInt(); int han=shin+1; double puh=Math.pow(shin,han); if(inpu=puh){System.out.println("congrats");}else{System.out.println("incorrect");}} }
4 Respostas
+ 7
First, it would be more easier for people to try your code, if you save it in the code playground, and insert a link here.
On quick inspection, you are taking input incorrectly. NextInt() is not valid on its own. The scanner object you created, has a nextInt() method. Pay attention to lowercase and uppercase letters too.
int inpu = sc.nextInt();
0
Try it before giving it to me
0
Ok I tried that and made a few other changes but it says I am converting a long into an int hers the code:import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int fruit = input.nextInt();
int carter=fruit/2/3;
double carte=Math.floor(carter);
int cartee=Math.round(carte);
System.out.println(cartee); }
}
0
I don't even know what a long is