Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
Function Modulo(ByVal Num As Double, ByVal divisor As Double) As Double Dim Temp As Double, Initial As Double Dim Remainder As Double, oldval As Double Initial = divisor If divisor > Num Then Modulo = 0: Exit Function Do Until divisor >= Num oldval = divisor divisor = divisor + Initial Loop Modulo = Int(Abs(oldval - Num))End Function
I have to write a program that will show all factors of a number after the input. Ex. if the user enters 8 the program will output 4 and 2.
dim N as longintdim i as longintdim j as longintdim product as longintinput "number ?", Ndim array(1 to N) as longintfor element=1 to N array(element)=0next elementfor i = 2 to N-1 for j = 2 to N-1 product=j*i if product=N then array(j)=1 array(i)=1 endif next jnext ifor element=1 to N if array(element)=1 then print element;" "; endifnext elementprint
S:\Test\Basic\factors>factors3number ?12 2 3 4 6S:\Test\Basic\factors>factors3number ?72 2 3 4 6 8 9 12 18 24 36S:\Test\Basic\factors>factors3number ?365 5 73S:\Test\Basic\factors>factors3number ?9978 2 3 6 1663 3326 4989S:\Test\Basic\factors>
hey.. guyz.. can someone know where to download.. ms visual basic..
1. Start your own thread; do not hijack somebody elses2. Post your code that you have done already.3. You do not say what language you are using.
1. Start your own thread; do not hijack somebody elses
do not hijack somebody elses