Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. double x = 1493.1987;
  2. string s1 = x.ToString("F3");
  3. string s2 = string.Format("Your total is {0:F3}, have a nice day.", x);
  4. // s1 is "1493.199"
  5. // s2 is "Your total is 1493.199, have a nice day."
  6.  
  7. double y = 1493;
  8. string s3 = y.ToString("F3");
  9. // s3 is "1493.000"
  10.  
  11. double pi = 3.1415927;
  12. string output = pi.ToString("#.000");
  13.  
  14. float a = 12.3578f;
  15. double b = 12.3578d;
  16. Console.WriteLine("The tolerance specs are: {0:F4} and: {1:F3}", a,b);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement