LoginSignup
0
0

More than 1 year has passed since last update.

【UNITY C#】 変数同士の割り算で少数を出したい時

Posted at

変数同士の割り算で小数を出したいけど、変数の後ろにはfが付けられないじゃないか(怒り)となったので、ググってみたけど中々出てこない。
探し求め続けること苦節30分、ようやく見つけたのでここに記しておく。

float percent = (float)correct / (float)count

要は変数の前に(float)をつければ良いのだ。

なぜこんな簡単なことを誰も書いていてくれなかったのか……
参考にさせて頂いた記事
https://norm-nois.com/blog/archives/5486
ありがとうございます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0