0

Whether the fraction can be used in the ( )in the loop?

For example: int n=1; while(n<a fraction){......} Is this right?

26th Jul 2019, 1:43 PM
LL26718
LL26718 - avatar
1 Respuesta
+ 1
You can, but you might want to change variable n to double or float instead of int, otherwise, it will be useless. NB. Using a fractional value can cause bug in your loop since floating point cannot represents every fractional value perfectly
26th Jul 2019, 1:55 PM
Agent_I
Agent_I - avatar