Adding Long Integers!

This is a discussion on Adding Long Integers! within the C Programming forums, part of the General Programming Boards category; How can we add too long integers (for example 20 digits) with usage of Strings?...

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    17

    Adding Long Integers!

    How can we add too long integers (for example 20 digits) with usage of Strings?

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I like to use four char arrays:
    carry[]
    add1[]
    add2[]
    =====
    sum[]

    Set each of them up with an initial value of 0 in them, and use them just like you would do it by hand, with a pencil, working from right to left. (so your index decrements, not increments).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. long integers and byte order
    By sonnichs in forum C Programming
    Replies: 19
    Last Post: 08-12-2011, 01:01 PM
  2. Long integers not long enough
    By cnewbie1 in forum C Programming
    Replies: 14
    Last Post: 10-31-2010, 04:32 AM
  3. Long Integers
    By SimonM in forum C Programming
    Replies: 25
    Last Post: 07-25-2007, 01:57 PM
  4. Long Integers
    By kabuatama in forum C Programming
    Replies: 24
    Last Post: 01-28-2006, 12:21 PM
  5. C++ help!!!!! Adding integers
    By PR1MO in forum C++ Programming
    Replies: 3
    Last Post: 04-30-2003, 05:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21