How to divide integers and get a float in C

前端 未结 2 635
余生分开走
余生分开走 2021-01-27 13:11

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

2条回答
  •  逝去的感伤
    2021-01-27 13:27

    You have to cast one of the ints to a float. For example:

    float L = (((float)letter_counter / word_counter) * 100);
    

提交回复
热议问题