Is there a reason I’m missing that this wouldn’t pass all 5 cases? // The Math Class - Java Code Coach import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = sc.nextInt(); int num2 = sc.nextInt(); double num3 = Math.pow(num1,num2); //your code goes here System.out.print(num3); } }
10/19/2020 7:08:36 PM
Roderick Davis11 Answers
New AnswerSome problem having test case error in Java course. I've implementaed own power function that too failed in same test case 4th. Maybe bug report to sololearn can help https://www.sololearn.com/discuss/2552818/?ref=app
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); int num1 = read.nextInt(); int num2 = read.nextInt(); //Please Subscribe to My Youtube Channel //Channel Name: Fazal Tuts4U System.out.println(Math.pow(num1, num2)); } }
D_Stark the question: Write a program to take numbers as input and return the first number raised to the power of the second number. Sample Input 2 4 Sample Output 16.0 //The only thing I added to the code was the num3 line and the print line.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message