473,804 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ 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,multip lication,divisi on 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 4716
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
17821
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 greater number than second 20 digit number ,then it should return.
33
13378
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
1194
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 anything... Thanks
13
6196
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 ------------------ b += (float)(mode *val); On 32 bit(intel , vs 2003, C++), some watch variables are
2
6404
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 Zytan
14
8666
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, but we started facing issues once we go above 15 digits. Thanks, Venkat
2
3432
by: puneet vyas | last post by:
hi,can any one put light on this question? thanks puneet vyas
3
1770
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 ---- ---- 90/2005
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10346
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10090
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6863
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5531
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.