So I am a second semester freshman in college. My teacher wants us to write a function that round a floating point number to the nearest hundredth. He said that we need to convert the floating point into an integer data type and then covert it back to a floating point. That's all he said. I have spent at least 5 hours trying different ways to do this.
This is my code so far:
#include <stdio.h>
int rounding(int roundedNum);
int main()
{
   float userNum,
         rounded;
   printf("\nThis program will round a number to the nearest hundredths\n");
   printf("\nPlease enter the number you want rounded\n>");
   scanf("%f", &userNum);
   rounded = rounding (userNum);
   printf("%f rounded is %f\n", userNum, rounded);
   return 0;
}
int rounding(int roundedNum)
{
   return roundedNum;
}
 
     
     
     
     
    