What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 16396 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > ASP.NET Interview Questions > In ToString("F2"), What does F ...

In ToString("F2"), What does F2 mean ?

Interview question and answer by: Bharathi Cherukuri | Posted on: 8/27/2012 | Category: ASP.NET Interview questions | Views: 763 | | Points: 40


Answer:

The output number string would be displayed upto some fixed point places after the decimal dot which is due to the instruction given by the letter F to the compiler.
The number 2 after the letter F is to display the output with 2 decimal places after the decimal dot, and the number has to be rounded.

Example:

double d = 35.3920002;
string s = d.ToString("F2");

Output:

35.39

Asked In: Many Interviews | Alert Moderator 
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

Even more ... | Submit Interview Questions and win prizes!

More Interview Questions from Bharathi Cherukuri

Even more ... | Submit Interview Questions and win prizes!


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 10:57:29 AM