+92 332 4229 857 99ProjectIdeas@Gmail.com

Integer To Float Conversion (C#.net)




The following code shows you convert from integer data type to float data type and vice versa.




 

Integer To Float Conversion:
 
int intNo = 2345;
float no = intNo;
Console.Write(no); // float can handle int because of upcasting


Float To Integer Conversion: 

float floNo = 1.5f;
int num = (int)floNo; // but here .5 value will be lost due to downcasting
Console.Write(num);




0 comments: