hey guys
i need your help please
really urgent
can u give me visual basic codes for
1- a program that calculates the greatest common divisible(divisor) by only (while) statement ...plz guys ! only while or if statements !

2- a program that prints the following nubers also by only while statement
0,1,1,2,3,5,8,13,21,34

as u can see 0+1=1, then 1+1=2 then 1+2=3 then 2+3=5 then 3+5=8 and so on ...

please guys help me

i really need your help

plz let be clear cause i am a beginner

thanks alot :) :cheesy:

Recommended Answers

All 2 Replies

hey guys
i need your help please

Duhhhh, we don't gots no intel'gint peeple here...

really urgent

OTay, I get rite on it! After all, your need is more important than mine...

can u give me visual basic codes for
1- a program that calculates the greatest common divisible(divisor) by only (while) statement ...plz guys ! only while or if statements !

Ummm, better wait til the smart guys show up. I can't write code for you - it wouldn't be your work. Even us dummies know the difference.

2- a program that prints the following nubers also by only while statement
0,1,1,2,3,5,8,13,21,34

Gee, talk to Fibonacci. It's his sequence.

as u can see 0+1=1, then 1+1=2 then 1+2=3 then 2+3=5 then 3+5=8 and so on ...

Oh? that's kool.

please guys help me

i really need your help

Please don't insult our intelligence like this.
#1: your title is offensive
#2: nothing is urgent
#3: Unless you try, we can't help. We're not going to do your work for you.

plz let be clear cause i am a beginner

thanks alot :) :cheesy:

Obviously :rolleyes:

Hi,

For Greatest Common Divisor Between a and b, Simpler code wud be,

Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim n As Integer
Dim i As Integer

If a<b then
n = a
else
n=b
end if
i=1
c =0
While i<= n
If (a mod i =0) And (b mod i) = 0 Then
c = i
End If
i=i+1
WEnd

c -->> Contains ur GCD


For Fibonnacci Sequence (n) :
This Code Prints in Debug Window, Alternatively u can add it to a listbox and show.


Dim a as Long
Dim b as Long
Dim i as Long
Dim k as Long

i=0
a=0
b=1
If n =1 then
Debug.Print a
elseif n=2 then
Debug.Print a
Debug.Print b
else
Debug.Print a
Debug.Print b
While i<= n-2
k = b
b=a+b
a= k
Debug.Print b
i=i+1
WEnd
End If


Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.