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.

Results 1 to 3 of 3

Thread: compute the square of a number

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default compute the square of a number

    hello plz help me
    how to solve this question in java programming
    write a method (and the calling statement) to compute the square of a number


  2. #2
    Member
    Join Date
    Oct 2013
    Location
    Saint-Petersburg, Russia
    Posts
    33
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default Re: compute the square of a number

    To compute square number you only need the number squared - i.e. multiplied by itself.

    Are you sure it is your problem?

    Perhaps you meant "Square Root"?

    There is a ready method Math.sqrt(x)...

    If you want to calculate it without library methods you can use either "Babylonyan method" - you can find comprehensive description here:
    Wiki: Square Root Approximation - CodeAbbey

    Or you can even use binary search.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,116
    My Mood
    Mellow
    Thanks
    186
    Thanked 658 Times in 645 Posts

    Default Re: compute the square of a number

    Please show some effort, then describe what you need help with, what you don't understand, errors received, etc. THEN we can help.

Similar Threads

  1. Replies: 10
    Last Post: April 21st, 2013, 09:28 AM
  2. How to Compute Interest
    By salsera1908 in forum Object Oriented Programming
    Replies: 5
    Last Post: December 4th, 2012, 01:38 PM
  3. Compute the average image value
    By IAmHere in forum Object Oriented Programming
    Replies: 3
    Last Post: January 16th, 2012, 11:07 PM
  4. Program to compute powers
    By Shyamz1 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 25th, 2010, 04:51 PM
  5. calculator GUI needs to compute
    By javanovice in forum AWT / Java Swing
    Replies: 3
    Last Post: May 4th, 2010, 02:16 PM