INT Function

The INT function truncates an expression to its integer value.

Format

INT(expr)

Parameter(s)

expr

An expression evaluating to a numeric value.

Description

Use the INT function to return the integer portion of an expression expr. The fractional portion of the value is truncated (not rounded), and the integer portion remaining is returned.

Example

In this application the INT function is used to calculate the number of items that may be bought for a given amount at a set price:

PRINT "HOW MUCH DO YOU HAVE TO SPEND?  $"  :

INPUT AVAILABLE

NUMBER = INT(AVAILABLE/PRICE)

PRINT "EACH ITEM COSTS "  :  PRICE"2,$" : "."                      

PRINT "FOR " :AVAILABLE"2,$" : "YOU CAN GET "

   :NUMBER :"ITEMS."

See Also

Statement and Function Reference