# logical problem in c/c++

• 09-09-2005
Rashid Ansari
logical problem in c/c++
please reply soon so that we can get to some serious job.

have problem in logic:

"WRITE A PROGRAM IN C / C++ WHICH CAN ADD ANY TWO NUMBERS"

* the length of number is undefined. i.e. it can be a 10 page long number .

* for ex: the program should be able to add:

12334345545656566767675675676768756454457645847578 48744787844354

+

76784358748745873457834545874654357884568758346587 45468756856578
• 09-09-2005
loko
This sounded like an interesting problem when i first read it, seemed really hard to do. Theres no variable type that can hold such large numbers( as far as i know ). Then i realized this could be done easily.

You just make a solution similar to how you solve on paper.
Adding evry number starting from the end of both inputs.

"12345"
+ " 11"
---------------
"12356"

Output the solution as String.

I hope you understand what i mean :D
• 09-10-2005
Salem
> please reply soon so that we can get to some serious job.
If this is so you can get a job (or keep a job), then forget it.