Im very confused by this code



How come when i run it, instead of it making c be 2.5 it makes it be 2? im very confused as to why

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
#include <stdio.h>  

int main(void)  
{  
int i,j;  float c,d,e,f,g,h;  i = 5; j = 2;  
d= 5.0; e = 2.0; f = 3.0;  
c =  i / j;  
printf("value of c is:  %f  \n", c);  
 
g = f + d /2;  h = (f + d )/2;  
printf("value of g h is:  %f,  %f  \n", g, h);  

return 0;  
}  
Yeah it seems to solve the problem but then im kind of confused. How come for G and H they dont need the float?
Topic archived. No new replies allowed.