percentage of two int?

前端 未结 5 690
说谎
说谎 2020-12-12 23:59

I want to get two ints, one divided by the other to get a decimal or percentage. How can I get a percentage or decimal of these two ints? (I\'m not sure if it is right.. I\'

5条回答
  •  生来不讨喜
    2020-12-13 00:21

    Well to make the decimal into a percent you can do this,

    float percentage = (correct * 100.0f) / questionNum;
    

提交回复
热议问题