Re: Round à number to 0, 10, 20, 30 etc...
Re: Round à number to 0, 10, 20, 30 etc...
- Subject: Re: Round à number to 0, 10, 20, 30 etc...
- From: Bill Briggs <email@hidden>
- Date: Sun, 8 Apr 2001 20:03:16 -0300
At 5:54 PM -0400 08/04/01, giZm0 wrote:
Hi, I am looking for a way to round a number (between 1 and 100) to its
3about ten2 (0, 10, 20, 30 etc..).
I tried several times with the 3round command2 but I just cant get it
right....
Can someone help me ?
Currently my script goes like this :
set curvol to (round (value/ 10)) * 10
With no attempt to be brief, but for maximum clarity (and assuming
you understand the rules by which AppleScript rounds numbers) this
will do what you want.
display dialog "Enter your number and I'll round it to the nearest
10" default answer ""
set x to (text returned of result as number)
set y to x / 10
set z to round y
set z to z * 10
set z to z div 1
display dialog "the rounded number you want is " & z
To be brief about it.
display dialog "Enter your number and I'll round it to the nearest
10" default answer ""
set z to ((round ((text returned of result as number) / 10)) * 10) div 1
display dialog "the rounded number you want is " & z
- web