473,473 Members | 4,204 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to perform operations on 200 digit numbers!!!!

1 New Member
hello everyone
i have to code a simple calculator program that performs addition,multiplication,division n substraction operations.
The operations are to be performed on 200 digit numbers (i.e 2131237287293.....upto 200 digits) however multiplication and division can be neglected but i need to perform atleast addition and substraction.
I am done with the calculator code, but the 200 digit thing is wat i am struck at.
How to do it?
wat is big float??is it usefull in my case?
the program is in C only.
Aug 16 '10 #1
3 4676
newb16
687 Contributor
You are probably expected to implement these long arithmetic operations yourself, without third-party libs. To simplify keyboard input one may choose BCD internal representation, like
struct longint
{
unsigned char digits[200];
int negative;
};
How to add multidigit numbers is something we know from elementary school.
Aug 16 '10 #2
weaknessforcats
9,208 Recognized Expert Moderator Expert
The number of digits is irrelevant. What you need to do is define your own number type. Then you write functions that use this number number type.

Once that's working you can expand the number of digits in your number type.

One challenge will be initializing your number type with a 200 digit value. That will probably lead you to start using strings for youer numbers:

Expand|Select|Wrap|Line Numbers
  1. NUMBER x;
  2.        Assign(x, "1234567"); /
  3.        x = Add(x, "10");  /* add 10 to x */
There I've written the code for you. All you need do is write those functions.
Aug 16 '10 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
@gprengan90: Please post your solution in this thread.
Dec 14 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: balakrishnan.dinesh | last post by:
hi frnds, Im having two 20digit numbers, But while comparing those it is giiving wrong ouput in javascript. for example here is my code, my secanrio is , ~ If first 20 digit number is...
33
by: Prasad | last post by:
Hi, Can anyone please tell me how to store a 13 digit number in C language ? Also what is the format specifier to be used to access this variable ? Thanks in advance, Prasad P
0
by: ptek | last post by:
Hi, Is it possible to show "001" in a NumericUpDown control when its value is "1" ? That is, displaying a fixed number of digits, 0 padded. I've read its documentation but I haven't found...
13
by: Shirsoft | last post by:
I have a 32 bit intel and 64 bit AMD machine. There is a rounding error in the 8th digit. Unfortunately because of the algorithm we use, the errors percolate into higher digits. C++ code is...
2
by: Zytan | last post by:
This page http://blog.stevex.net/index.php/string-formatting-in-csharp/ shows: {0:0,0} but for single digit numbers, it prefixes a 0! Is there a way that works with single digit numbers? thanks...
14
by: thehobbit | last post by:
Hi, Could anyone give ideas on how to add 4 20 digit numbers in ANSI C and pass the result back to a calling program in COBOL? We were able to add up to 15 digit numbers without any problems,...
2
by: puneet vyas | last post by:
hi,can any one put light on this question? thanks puneet vyas
3
by: shalskedar | last post by:
In my Database for 1 of the fields as "ID " i need to display the criteria as 10/2...followed by some characters till 90/2--- for ex-10/2001 11/2008 ---- ---- ...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.