what exactly is mean by paper to pencil algorithm and what is it? I am doing a program where two numbers are stored in an array, and are reversed in the array, and I need to add them together, how do I go about doing it with paper to pencil algorithm?

Someone else correct me if I'm wrong, but you just write in pseudo code (not completely syntactically correct) the basic algorithm.


Not quite sure what you're asking about the array though

I think what you are asking is how add number as long as 100 000 digits.

I think the algorithm you are talking about is basically you developing a piece of code that adds just the way you would add two numbers on a piece of paper. For example, you would start from the last digit of the number (the last digit on the right) and you add them. If the sum of these two digits is bigger than 9 then you carry 1 else you just store the sum of the two digits. You then move one digit left and you repeat the same process while taking the carried digit in account. The end result would be the sum of these two number!!

You also need to take a look at these topic :

> ASCII values of the numbers
> loops
> reversing arrays
> Padding make them equal in length
> Adding and substracting using ASCII values

I can't think of any more but there may be problems that you'll have to get around.....

commented: Bingo! +30
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.