How can we extract the decimal part of a floating point number and store the decimal part and the integer part into two separate integer variables?
Even I was thinking how to do it. But I found a way. Try this code
printf("Enter a floating number"); scanf("%d%c%d", &no, &dot, &dec); printf("Number=%d Decimal part=%d", no, dec);
Output:-
Enter a floating number 23.13 Number=23 Decimal part=13