Closed Thread
Results 1 to 2 of 2

Thread: decimal points

  1. #1
    lcm_pang is offline Newbie
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    decimal points

    Can anyone could tell me how to make the double variable to 2 decimal point?

    example: double x=65.2226

    the result will be x=65.22

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    QuackWare is offline Learning Programmer
    Join Date
    Jan 2010
    Posts
    95
    Rep Power
    8

    Re: decimal points

    Try this:

    Code:
    double x = 65.2226;
    x = Double.Parse(String.Format("{0:#.##}", x));

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Decimal Bug
    By strokerace in forum C and C++
    Replies: 1
    Last Post: 10-02-2010, 07:48 AM
  2. adding up decimal ...
    By xxxxjayxxx in forum C# Programming
    Replies: 1
    Last Post: 07-23-2010, 04:11 AM
  3. Decimal to Roman
    By TkTech in forum Classes and Code Snippets
    Replies: 5
    Last Post: 09-21-2009, 02:55 PM
  4. [PL/SQL] Decimal multiplication
    By njr1489 in forum Database & Database Programming
    Replies: 6
    Last Post: 05-16-2009, 01:22 PM
  5. Points?
    By Johnnio in forum The Lounge
    Replies: 2
    Last Post: 08-15-2007, 07:54 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts