Pages: 1
Topic closed
Hi, i have a problem. Sorry my english is bad.
The problem is.
set a to 12 / 10
I need to return 1 only, and not 1.2.
Similarly:
set b to 18 / 10
I need to return 1 Solal, and not 1.8.
Any idea how to do this?
Thank you very much.
Offline
Use the round block. It's green, and will round it to nearest... whatever. You get the picture.
-12three-
<round(
Offline
12three wrote:
Use the round block. It's green, and will round it to nearest... whatever. You get the picture.
-12three-
<round(
That won't work. Unless I'm mistaken, he wants to just cut the decimal off, not round it. (He wants 1.8 to return 1, not 2, which it would round to.) What you need is a script like this:
Offline
Use (letter (1) of (a)) - it'll take the first character of the variable "a", which is the number you want.
Offline
yz7hmpm wrote:
No really.
The function "round" just do it:
round (1.2) = 1
round (1.8) = 2
I said that i need that back:
1.2 = 1
1.8 = 1
Pls help me...![]()
See my above post. ^
@jonathanpb: That would work too, unless the number was 10 or more.
Last edited by Harakou (2010-10-18 20:44:52)
Offline
This shows the divisors of a number n pairs, and also all displayed digits must be even.
Example n = 60
Must show:
2
4
6
20
60
Try the code you gave me, but turns to negative numbers.
Thank you for your help. I hope answers.
Offline
Ugg. *shudders* Don't say integer around me. The first time I took a pre-algebra test I got an F.
Offline
set a to (round ((12/10)-1/2))
that will get 1.
I guarantee that works.
<set{ a }to( <round( (((( 12 </>10 )) <-> 0.5 )) )
Offline
Harakou wrote:
12three wrote:
Use the round block. It's green, and will round it to nearest... whatever. You get the picture.
-12three-
<round(That won't work. Unless I'm mistaken, he wants to just cut the decimal off, not round it. (He wants 1.8 to return 1, not 2, which it would round to.) What you need is a script like this:
http://i51.tinypic.com/2h74dqh.gif
Whoops, didn't quite understand. This method should work.
-12three-
Offline
Just use this:
[blocks]<round( (( something <-> 0.5 ))[/blocks]
Offline
Examples:
set left over to 12 mod 10
Left over will become 2
set Answer to 12 - Left over / 10
Done. Hope this helped you. This works for everything.
Last edited by wei2912 (2010-10-20 00:18:48)
Offline
Topic closed
Pages: 1