473,326 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to select the integers after the decimal?

So, I'm pretty new to C# but heres my problem.
After multiplying a number by a percentage I am converting the double to an int and assigning that to a variable. However, I also need to get the the integers after the decimal and assign them to another variable.

What is the syntax that allows me to select the integers after the decimal?
Feb 1 '11 #1
1 1513
Rabbit
12,516 Expert Mod 8TB
There's no such thing as an integer after a decimal since an integer by definition is a number without a fractional part.

However, that is just semantics and what you mean is that you just want the "fractional" part of the the percentage. I'm assuming you multiplied the percentage by 100 otherwise you wouldn't have an integer portion of the percentage.

Just take the double and subtract the integer.
Feb 1 '11 #2

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

Similar topics

21
by: Batista, Facundo | last post by:
Here I send it. Suggestions and all kinds of recomendations are more than welcomed. If it all goes ok, it'll be a PEP when I finish writing/modifying the code. Thank you. .. Facundo
7
by: hana1 | last post by:
Hello experts, I used to program in C/C++ and now switched to Java. I am having a difficulty that I need your help with. How can I limit a double variable to hold 2 decimal points only? Say I...
2
by: Steve Summit | last post by:
-----BEGIN PGP SIGNED MESSAGE----- It's often explained that the reason for some of the imprecision in C's definition is so that C can be implemented on different kinds of machines -- say, those...
2
by: othellomy | last post by:
select convert(float,'1.2334e+006') 1233400.0 select convert(decimal(20,2),'1.2334e+006') Server: Msg 8114, Level 16, State 5, Line 1 Error converting data type varchar to numeric. Is there...
13
by: Gregor =?UTF-8?B?S292YcSN?= | last post by:
Hi! Let's have a data of type DECIMAL(6, 2) and with value 0.01. How can I convert this one into a "pretty" CHAR? I've tried VALUES(CHAR(DECIMAL(0.01, 6, 2))) and I get 0000.01 which is not...
3
by: flickimp | last post by:
Hi Please help with this: When I enter Select 2800 / 1000 I get 2, but I am expecting 2.8
3
by: kimi | last post by:
hi all, can anyone tell me how to convert a comp-1 floating point number to a decimal in REXX??
9
by: Mark Morss | last post by:
I would like to construct a class that includes both the integers and None. I desire that if x and y are elements of this class, and both are integers, then arithmetic operations between them,...
2
by: karanbikash | last post by:
hi , I have a column with datatype as decimal(31,2) . The data is like 123456.67 , 7634578.99 Is it a way to convert the entire number into character . like '1232456.67' . The output...
17
by: D'Arcy J.M. Cain | last post by:
I'm not sure I follow this logic. Can someone explain why float and integer can be compared with each other and decimal can be compared to integer but decimal can't be compared to float? True...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.