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 4 of 4

Thread: arithematic operation on arrays

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post arithematic operation on arrays

    can anybody tell me how we can divide an integer array with another integer array..

    Example- 12345/243

    As 12345 will be as
    numberarray[0]=1;
    numberarray[1]=2;
    numberarray[2]=3;
    numberarray[3]=4;

    is to be divided by another array secondarray as 243
    secondarray[0]=2;
    secondarray[1]=4;
    secondarray[2]=3;


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: arithematic operation on arrays

    What does the array's contents represent?
    What is the value represented by each slot in the array?
    What value is in slot 0?
    What value is in slot 1?

    What results are you expecting?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: arithematic operation on arrays

    there could be any value . i just need to divide one number which exceeds the limit of int and long (may be 50 digit number) with other 50 digit number and i don't have to use biginteger in java. so there is only other way is arrays. so i am not able to find out how to divide the values in arrays.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: arithematic operation on arrays

    If you can't use the BigNumber classes and must use arrays to hold the digits for the number you will need to work out an algorithm for doing the division. Take a piece of paper and a pencil, write out digits for the two arrays and a results array and see what it will take to do the division. I've never seen this problem worked out and don't have any ideas other than to do some experimenting on paper to see how to do it.

    Some observations
    For the number 12345
    the digit in [0] is * 10^4
    the digit in [4] is * 10^0
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Operation on a txt file..
    By Davidifier in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 9th, 2012, 01:30 PM
  2. Problems with if else if statement operation
    By Farmer in forum Loops & Control Statements
    Replies: 4
    Last Post: May 29th, 2012, 06:43 AM
  3. Byte Operation
    By tcstcs in forum Java Theory & Questions
    Replies: 4
    Last Post: March 27th, 2011, 11:19 PM
  4. Operation ==
    By meytalg in forum Java Theory & Questions
    Replies: 6
    Last Post: January 4th, 2010, 07:43 PM