OpenJudge 04:Output floating-point numbers with 3 decimal places

Description

Read a single - precision floating point number to retain the three - digit number output this floating point number.

Input

There is only one line, a single precision floating point number.

OUTPUT

There is only one line, read the single precision floating point number.

Input Sample

12.34521

OUTPUT SAMPLE

12.345

source

Exercise (2-2)

idea

Format output with Printf.

Answer

CPP

include

include

using namespace std;
int Main ()
{{
Float a;
cin >> a;
Printf ("%1.3F", a);
Return 0;
}

Result

Used Memory: 200KB
Run time: 10ms
Language: G ++
Submit time: 2019-03-24 09:04:38

[http://noi.openjudge.cn/ch0101/04/.

OpenJudge 04:Output floating-point numbers with 3 decimal places

https://blog.tsinbei.com/en/archives/193/

Author
Hsukqi Lee
Posted on

2022-02-19

Edited on

2022-08-04

Licensed under

CC BY-NC-ND 4.0

# Programing  Cpp  OpenJudge  NOI  NOIP

Comments

Name
Mail
Site
None yet