Number to floating point | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Number to floating point

How to convert a number to floating point in c language? Can someone help me with the code? I just need the algorithm. I can figure out the code.

4th Oct 2018, 12:33 AM
Jaskirat Singh
Jaskirat Singh - avatar
2 Answers
+ 7
int n=3,f float f=(float)n;
4th Oct 2018, 5:19 AM
Coder
Coder - avatar
+ 3
Cast it using this syntax: (final type)expression; Eg : int num = 5; float res = (float)num;
4th Oct 2018, 12:36 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar