-
help with java assignment
I must write a program which receives 2 integer inputs, x and y, and computes
x to the y power (without using the Math.pow method).
I must write code which perform this computation.
I must say I am desperately needing help.
-
Re: help with java assignment
What part of it do you need help with? What have you done so far?
"Bumi, Windu " <wbumi@rcnchicago.com> wrote in message
news:3bcc78b3$1@news.devx.com...
>
> I must write a program which receives 2 integer inputs, x and y, and
computes
> x to the y power (without using the Math.pow method).
> I must write code which perform this computation.
>
> I must say I am desperately needing help.
>
-
Re: help with java assignment
public class temp{
private static long s(int a,int b){
for(int i=1;i<b;i++)
a*=a;
return a;
}
public static void main(String[] args){
long temp=s(10,2);
System.out.println("s(10,2)="+temp);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks