2014년 12월 2일 화요일

Blocks for repeating decimal

I need a block that can get the algarisms of a number and puts it in a list. For example: 0,7514892 needs to be on a list with 7 as item 1, 5 as item 2.. I need this to identify a repeating decimal. 
Anyway, someone has done something like this or has another solution for this?



write your own custom procedure, there are all blocks available you need, e.g. loops, text blocks, list blocks, see also the documentation http://appinventor.mit.edu/explore/ai2/support/blocks.html

first do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.htmlto learn the basics of App Inventor, then try something and follow the



Look in the math blocks for quotient and remainder.
Let's say you want to do 20 digits, and your initial number is
between 0 and 1.

Start with an empty list.
Add the first digit before the decimal point (0) to your list.
Set the number to the fractional part times 10: 7.514892
Add the first digit before the decimal point (7) to your list.
Set the number to the fractional part times 10: 5.14892
Add the first digit before the decimal point (5) to your list.
Set the number to the fractional part times 10: 1.4892
Add the first digit before the decimal point (1) to your list.
Set the number to the fractional part times 10: 4.892
etc. until 20 times or fractional part = 0

Note that you can use floor() to get the leading digit,
and  (n-floor(n)) to get the fractional part.


댓글 없음:

댓글 쓰기