Display the Given Float Value as the Nearest Integer Value - Learn Engineering

All the news and updates relevant to Engineering. You can also Write a post here

Breaking

Wednesday, May 27, 2020

Display the Given Float Value as the Nearest Integer Value

Question

Display the Given Float Value as the Nearest Integer Value

Sample TestCase Expected Output

1. 12.412


2. 12.813


    #include<stdio.h>
    #include<math.h>
      int main()
    {
        float num;
        scanf("%f",&num);
        printf("%.0f",num);
        return 0;
    }

Follow Us For More...

1 comment: