Get a Float value and Print the Float value Without any Trailing Zeros - Learn Engineering

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

Breaking

Tuesday, June 30, 2020

Get a Float value and Print the Float value Without any Trailing Zeros

Learn C programming

Question

Get a Float value and Print the Float value Without any Trailing Zeros

Sample TestCase Expected Output

1. 12.520012.52


2. 567.90000567.9


Answer

    #include <stdio.h>
    int main()
    {
        double num;
        scanf("%lf",&num);
        printf("%g",num);
        return 0;
    }


Comment What problem Do you Need...

Follow Us For More...

No comments:

Post a Comment