Re: [R] quotient and remainder

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 23 Jun 2005 - 17:06:03 EST

On Thu, 23 Jun 2005, zhihua li wrote:

> hi netters
>
> Is there a function in R that can compute the quotient and remainder of a
> division calculation? such that when 11 is given as the dividend and 5 the
> divider, the function returns 2(quotient) and 1(remainder).

> 11 %% 5

[1] 1
> 11 %/% 5

[1] 2

See ?Arithmetic.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Jun 23 17:11:59 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:58 EST