Search code examples
number-formattingpascalreal-number

Two digits after the decimal point in a real number in Pascal


So for an example i have a real number let's say 17.4578 but i want to display it in pascal with only two digits after the point so it's 17.45. What do i write in my program?


Solution

  • Write(17.4578:0:2)
    

    Will display number 17.46
    Generally, arguments look like this → Value : field_width : decimal_field_width
    For more info click here