how to convert int to float in c#

99

how to convert int to float in c# -

int val1 = 1;
float val2 = (float)val1;

how to convert float to int c# -

float someFloat = 42.7f;
int someInt = (int)someFloat;               // 42

Comments

Submit
0 Comments