Saturday, March 2, 2013

Arranging the given array with odd numbers at first & even Numbers at last

'creating empty Strings
s=""
s1=""

'The below is the given array
a=array(1,2,3,4,5)

'Checking whether the item is odd or even
for i=0 to ubound(a)
if a(i) mod 2 = 0 then
s=s&a(i)
else
s1=s1&a(i)
end if
next

'concatenating odd & even
str=s1&s
cou=len(str)

'Adding all the element in the string to array
for i=1 to cou
st=mid(str,i,1)
a(i-1)=st
Next
mystr=join(a)

'Verifying whether the array is as per the requirement
msgbox mystr

Wednesday, February 6, 2013

Rotate Array, check for a match & rotation count

Function ArraymatchCheck

'Two arrays that need to be checked

A= Array(1,2,3,4)
B= Array(1,2,3,4)
count1=0
ordrr=false
C=join(A)
E=join(B)

'Check whether two matches at first
if Eval(C=E) then
ordrr=true
msgbox "It taken "&count1&" rotations to get the match",,"Rotation Count"
Exit Function
end if

'Do rotation & Check for match
Do until Ordrr= true
temp1=B(0)
B(0)=B(1)
B(1)=B(2)
B(2)=B(3)
B(3)=temp1
C=join(A)
D=join(B)
count1=count1+1

If Eval(D=E) Then
    msgbox "Match cannot be made",,"Warning"
    Exit Do
End If
if Eval(C=D) then
ordrr=true
msgbox "It taken "&count1&" rotations to get the match",,"Rotation Count"
Exit do
end if
loop

End Function

ArraymatchCheck

Saturday, December 3, 2011

Some songs that I love.....Christian

These are some that I love to hear mostly......

Note: This is not in any order

New Boys -- Born Again
Plus one -- God in this place
Third Day -- Nothing Compares
Chris Tomblin -- Our God(Radio)
Natalie Grant --The greatness of our God
Casting Crowns -- Stained Glass
Tobymac -- Somebody's watching
Don Moen -- Micarazon
Stacie Orrico -- Stuck up Hillsong -- Hosanna