Raghaw
Raghaw

Reputation:

How can I Fix the float value in output in C language

I have output like this:

1569.3669
15968.3699
41.3878
587.5401

but I want the output like this:

01569.3669
15968.3699
00041.3878
00587.5401

How can I do this in the C language?

Upvotes: 1

Views: 1264

Answers (1)

mdec
mdec

Reputation: 5242

printf("%010.4f", val);

Should do it for you, where val is each value. For more info see here

Edit: Thanks Barry.

Upvotes: 7

Related Questions