Here I have already written the code which prints the rightmost integer of a float number, however when I run the program and put in a number, the program closes immediately. Can anyone help me fix this problem?
Code:
#include <stdio.h>
int main (void)
{
// Local Declarations
int fltNum;
int oneDigit;
// Statements
printf("Please enter in a float number: ");
(float)fltNum;
scanf("%d", &fltNum);
oneDigit = fltNum % 10;
printf("\nThe right digit is: %d", oneDigit);
scanf("%d", &oneDigit);
int temp;
printf("Enter an integer and press Enter to exit the program: ");
scanf("%d", &temp);
return 0;
}