convert int to float in c code example
Example 1: type change in c
#include <stdio.h>
main() {
int sum = 17, count = 5;
double mean;
mean = (double) sum / count;
printf("Value of mean : %f\n", mean );
}
Example 2: c float to int
# you can cast in c like so
float my_float= 1.446;
int my_int = (int) my_float;
Example 3: int to float c
float percentage;
percentage = (float)number/total * 100;