✅ converting fractions to percentages and getting an output of 0 no matter what?
the mark variables were user inputted integers but when i use this method to get percentages, i outputted them to check they were correct and they are always 0?
7 Replies
perc variables are doubles and mark variables are ints
Because you're doing integer division
Angius
REPL Result: Success
Result: int
Compile: 137.152ms | Execution: 16.259ms | React with ❌ to remove this embed.
Cast one of the numbers to a double, for example, or use a double literal
Angius
REPL Result: Success
Result: double
Compile: 281.412ms | Execution: 16.428ms | React with ❌ to remove this embed.
thank you so much
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View