I\'m building a paragraph difficulty labeler by getting the number of words, sentences and letters.... I\'m trying to divide to integers and get a float for example ((let
You have to cast one of the int
s to a float
. For example:
float L = (((float)letter_counter / word_counter) * 100);
You could put 100.00
rather than 100
to tell the compiler to evaluate the expression as a floating point expression as follows:
int num1 = 80;
int num2 = 21;
float L = (num1 * 100.00) / num2; // 100 -> 100.00
It'll result:
380.952393