Novo curso! Todo programador deveria aprender IA generativa!
+ 2

If the result of an integer division, where both the numerator and the denominator are integers, is a fraction, the fractional part is____?

1st Oct 2021, 4:54 PM
Shoug Souliman
20 Respostas
+ 3
"the fractional part is..." ... obtained by using the modulus operator, % and doing floating point divide of the denominator. Or in decimal, by performing the division in floating point and using the frac() library function.
1st Oct 2021, 5:46 PM
Brian
+ 2
truncated? There could be many different answers...
1st Oct 2021, 4:57 PM
+ 2
It depends on data types you are storing the division result
1st Oct 2021, 5:01 PM
+ 2
Shoug Souliman , so correct answer is "rounded down to the nearest integer"
1st Oct 2021, 5:10 PM
+ 2
Eashan Morajkar , yes. So? It's incomplete answer to his question.
1st Oct 2021, 5:11 PM
+ 2
During an integer and an integer division the fractional part is removed
1st Oct 2021, 5:17 PM
Eashan Morajkar
+ 2
Eashan Morajkar yup, this will also be a correct answer...
1st Oct 2021, 5:18 PM
+ 2
Brian The fractional part are the numbers at the right of the decimal point e.g 2.31 Fractional part = 31 Its the part gotten by subtracting the integer part of number by the number
1st Oct 2021, 5:50 PM
Eashan Morajkar
+ 2
To get only the fractional part in C: num-((int) num)
1st Oct 2021, 5:52 PM
Eashan Morajkar
+ 2
2nd Oct 2021, 3:52 PM
+ 2
The division of both integer will result in integer division.if you want the result in fraction Define the denominator as fraction value. Eg: 5/5=1 5/5.0=1 0
2nd Oct 2021, 5:58 PM
Gopinath
+ 2
Rishi , did he delete his answer or you just posted this in the wrong thread?
3rd Oct 2021, 12:07 PM
+ 2
3rd Oct 2021, 3:00 PM
Rishi
+ 2
Shoug Souliman its answer depends upon the data type in which you are storing the fractional value. If you store in integer data type then it give always the integer value, and same will be in the case of float but in float case you will get the the integer value with append zero only(will not give the exact fractional Result).
28th Oct 2021, 8:18 AM
Neeraj Kumar
+ 1
Shoug Souliman, if you put the division result inside int or if you print it, the result will be rounded down to the nearest integer.
1st Oct 2021, 5:03 PM
+ 1
Eashan Morajkar , this is just a single case... It doesn't mean any division will result in 0. For example if you divide 5/3 it will result in 1, so as I said it will be rounded down.
1st Oct 2021, 5:08 PM
+ 1
Even if you change division to int data type, the output will be 0, which means the fractional part is also 0
1st Oct 2021, 5:08 PM
Eashan Morajkar
+ 1
Aleksei Radchenkov But the fractional part is still 0
1st Oct 2021, 5:10 PM
Eashan Morajkar
+ 1
How to convert input string into the list... How to calculate each letter letter in string. eg. Hi hello So returns 7 letters
2nd Oct 2021, 3:41 PM