will you pls help me on how to create program in java that will ask for two numbers, num and n,and then returns the nth root of num.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
will you pls help me on how to create program in java that will ask for two numbers, num and n,and then returns the nth root of num.
If you don't understand my answer, don't ignore it, ask a question.
String input = console.readLine("Please enter your first number:");
int newinput = Integer.parseInt(input);
String input2 = console.readLine("Please enter your second number: ");
That's a start. Now put that code in a method in a class, compile it and execute it and see what happens.
When posting code please wrap your code with code tags:
[code=java]
<YOUR CODE HERE>
[/code]
to get highlighting and preserve formatting.
If you don't understand my answer, don't ignore it, ask a question.
Now i have been trying this but still can't work
String input = console.readLine("Please enter your first number:");
int newinput = Integer.parseInt(input);
String input2 = console.readLine("Please enter your second number: ")
double Result = Math.pow();
if (n==0)
{
return1.0 ;
}
return x*pow (x,n-1);
Please post a complete program and wrap it in code tags. What you have posted is incomplete.
If you don't understand my answer, don't ignore it, ask a question.