
-----------------------------------
appling
Thu Dec 04, 2003 5:38 pm

about positive divisors.
-----------------------------------
first it randint a lot of numbers,then, i want to display those numbers that the numbers' positive divisors (factors) is 3.

HOw could i do that? :?:  :?:
and how to know a number is real or int??

-----------------------------------
Dan
Thu Dec 04, 2003 5:47 pm


-----------------------------------
i am not 100% shure of what you are asking but may be this is close?


var temp : int

for i : 1 .. 10
    temp := Rand.Int (1, 100)

    put temp, " - " ..

    if temp mod 3 = 0 then
        put "can be div by 3"
    else
        put "can NOT be div by 3"
    end if

end for


the mod comand returns the reamned of the 1st therem div the 2nd
if the renamder is 0 then it diveds evenealy in to it

-----------------------------------
appling
Thu Dec 04, 2003 6:10 pm


-----------------------------------
just use "mod", :D  :D i forget it, thank u very much
but please help me with the 2nd questions-------how to know a number is real or int??

-----------------------------------
Dan
Thu Dec 04, 2003 6:12 pm


-----------------------------------
well that may be hard, since if you input it as a int and it is real turing will crash. you best bet is to input a number as a real number then round it no matter what if using it for somting that needs to be int.

-----------------------------------
appling
Thu Dec 04, 2003 6:15 pm


-----------------------------------
ok,thanks all the same
