+ 7

The Math Class

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); } }

19th Oct 2020, 7:08 PM
Roderick Davis
Roderick Davis - avatar
12 odpowiedzi
+ 2
Some 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
20th Oct 2020, 10:35 AM
Preity
Preity - avatar
+ 3
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)); } }
4th Sep 2021, 7:27 AM
Fazal Haroon
Fazal Haroon - avatar
+ 2
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(); System.out.println(Math.pow(num1, num2)); } }
26th Feb 2023, 2:00 PM
kavindu shehan
+ 1
Theres no reason why this wouldent work, what is the problem your having?
19th Oct 2020, 7:23 PM
D_Stark
D_Stark - avatar
+ 1
Have you tried creating your own function?
20th Oct 2020, 7:06 AM
D_Stark
D_Stark - avatar
0
D_Stark im only passing 4/5 cases lol
19th Oct 2020, 7:44 PM
Roderick Davis
Roderick Davis - avatar
0
Do you have a link for it so I can see the question ?
19th Oct 2020, 7:53 PM
D_Stark
D_Stark - avatar
19th Oct 2020, 7:55 PM
Roderick Davis
Roderick Davis - avatar
0
I dont have pro sorry maby someone else can help 😊
19th Oct 2020, 8:22 PM
D_Stark
D_Stark - avatar
0
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.
19th Oct 2020, 8:27 PM
Roderick Davis
Roderick Davis - avatar
0
double num3 = (double) Math.pow(num1, num2);
21st Oct 2020, 11:38 AM
Keegan Sichone
Keegan Sichone - avatar
0
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); } }
15th Nov 2022, 7:50 AM
Pooja Patel
Pooja Patel - avatar