I'm trying to divide 2 integer and get the float results but it does not seem it is working properly. Can you see where am i doing wrong? sscanf part is working, the problem is at the dividing part.
char *latitude = "4055,1792.N";
int val1;
int val2;
int val3;
float result;
sscanf ( latitude, "%2d%2d,%4d", &val1, &val2, &val3);
printf("\r\nval1 = %d val2 = %d val3 = %d\r\n",val1,val2,val3);
result = val1 + (float)val2/(float)60 + (float)val3/(float)600000;
printf("\r\nResult = %f\r\n",result);
printf("\r\nEnd\r\n");
This code does not result this operation. Here is the output:
val1 = 40 val2 = 55 val3 = 1792
Result =
End