473,609 Members | 2,241 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Print a number of size 19 digit

I have a problem in a piece of C Program.
I have to print a number of size 19 digit (No decimals).
What data type should I use to store and print this no.
I have already tried using double, long double but in vain. I also
think that it might have to do with our environment setting but do not
know what to change. I searched in the new but was not lucky.

Requirement:

Actually, there is a hexadecimal number. That needs to be changed to a
whole number, then it has to be stored in a variable, then some
processing needs to be done on that , and finally it needs to be
printed on screen.

So, it seems long double can store the number. But, prints it in 23e25
kind of format, whereas what we want is all digits (like
235876273856346 783)
Nov 14 '05 #1
1 1528

Bhanu wrote:
I have a problem in a piece of C Program.
I have to print a number of size 19 digit (No decimals).
What data type should I use to store and print this no.
I have already tried using double, long double but in vain. I also
think that it might have to do with our environment setting but do not know what to change. I searched in the new but was not lucky.


In standard C, you can't do that. Search for "bignum" using your search
engine. If you don't require the highly generalized format of these
libraries, you can create your own. The basic aspect is that you take
and deal with them in a way you would deal with BCD, Binary Coded
Decimal.

HTH

--
Imanpreet Singh Arora

Nov 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
6351
by: Protoman | last post by:
Hi!!! Protoman here, I need to write an infinite precision number class b/c I want to compute pi. Give me some sample code. Also, when I run my program and it computes pi, will my computer freeze b/c it's infinite precision? Thanks for the help!
3
9897
by: kathy | last post by:
I want to know what is the easy way to check if a string is a number or not? the number can be int, float, double, scientific,... what is the easy way for only interger?
7
4836
by: ffrugone | last post by:
I need to create a method for a web page I'm building that encrypts a number from 1 to 1000 into a 4 digit hex code. I know nothing about cryptography. Can anyone steer me in the right direction?
2
27320
by: hikmaz | last post by:
I am trying to get the rightmost digits (%10) of a number (taken from the user) and store it into successive array locations and get rid of the rightmost digit (\10) to store the next and so on and so forth. For example, if the number entered by the user is 4321 then, int array = 1 int array = 2 int array = 3 int array = 4 int array = '\0' (End of array - when number == 0) This is the piece of code i...
2
2918
by: xp5 | last post by:
Hi, I'm trying to find the total number of digit for a user's input integer. I'm using the sizeof() function but keeps getting the size is 4 for some odd reason. For example sizeof(32333) is 5 but it gives me 4. The following is my code, and my sizeof() function is near the middle. Thank you in advance #include<stdio.h> int main(void)
6
6886
by: bitong | last post by:
The problem is input a number then the output should be in reverse order.. I already made a code but only good for 9 - digit only...What I want to do is to hold infinite digit, in other words don't have a limit on how many digit that I want to input.. for (x = y;x>0;x=x/10){ z = x % 10; cout<<z; } * code good for 9 - digit only, if I input 10 digit its...
12
11494
by: waterdriven | last post by:
Hello; I am a newbie. A homework assignment was assigned and I am having trouble getting started. The assignment reads: Write a program to print out the binary value of a 16 bit number.
36
4027
by: Kapteyn's Star | last post by:
hi group, i try to compile code below but my compiler is failing. it tells:- printbin.c: In function ‘main’: printbin.c:9: error: invalid operands to binary & i am not able to understand what it mean. how to correct fault? please help i'm only new to C. #include<stdio.h> #include<math.h> main()
14
2841
by: mathieu | last post by:
hi there, I do not understand the syntax for ios_base::precision. Let say I have a floating point: const float f = 0.313244462; How do I write is to a stream ? const float f = 0.313244462;
0
8051
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8557
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8512
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
8203
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
6981
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5504
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
4066
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2517
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
1
1637
muto222
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.