Casting

Lab C Beginner 10 points

Read a decimal number. Print it truncated to an int, rounded to the nearest int (add 0.5 then cast, for positive numbers), and with 1 decimal.

Input

One positive decimal number.

Output

Three lines.

Example

Input

3.7

Output

3
4
3.7
Sample input available Sample output available
Editor
C

Hints

Read a double with %lf in scanf.

(int) chops off the decimal part.

Solution explanation

Note: scanf needs %lf for a double, but printf uses %f.

Show solution
#include <stdio.h>

int main() {
    double x;
    scanf("%lf", &x);
    printf("%d\n", (int) x);
    printf("%d\n", (int) (x + 0.5));
    printf("%.1f\n", x);
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD