Question regarding extraction of value from a decimal fraction
Dear All,
I want to extract the integer value just after the decimal point from any number, for example integer 1 from 1.250. Below is my code for the same. However, I get an error while extracting the integer value(written below the code):
Code:
#include<stdio.h>
#include<stdlib.h>
int main()
{
float i=1.25,num=0;
num=i%10;
printf("%f",num);
system("pause");
return 0;
}
"invalid operands to binary % "
Please suggest modifications/changes. Thank you.