Input = 124

output should be 124421
Please do not use any string functions/variables

Answers were Sorted based on User's Feedback



Input = 124 output should be 124421 Please do not use any string functions/variables..

Answer / manjunathareddy

Dim n
Dim s
Dim x
input=124
n=124
While int(n)>0
s=n mod 10
x=x&s
n=Int(n)/10
Wend
Msgbox input&x

Is This Answer Correct ?    6 Yes 0 No

Input = 124 output should be 124421 Please do not use any string functions/variables..

Answer / eswar

'Numbers can be given at run time
For i=1 to 3
s =InputBox("Enter a number : ")
x = x&s
y = StrReverse(x)
Next
MsgBox x&y

Is This Answer Correct ?    2 Yes 2 No

Input = 124 output should be 124421 Please do not use any string functions/variables..

Answer / bibhu

Hi Eswar,

The catch here is to not using any vb script functions

Thanks,
Bibhu

Is This Answer Correct ?    0 Yes 0 No

Input = 124 output should be 124421 Please do not use any string functions/variables..

Answer / bherolal bhargav

i=cint(inputbox("Enter 3 digit No."))
i = i*1000+((i mod 100) mod 10)*100+((i mod 100) -(i mod
100) mod 10)+i\100
msgbox i

Is This Answer Correct ?    1 Yes 1 No

Input = 124 output should be 124421 Please do not use any string functions/variables..

Answer / gyanesh ranjan rout

Function printnumber(numb)

x=numb
y=strreverse(x)

msgbox x&y
End Function

printnumber(124)

Is This Answer Correct ?    2 Yes 2 No

Input = 124 output should be 124421 Please do not use any string functions/variables..

Answer / ramesh

Dim n
Dim s
Dim x
input=124
n=124
While int(n)>0
s=n mod 10
x=x&s
n=Int(n)/10
Wend
Msgbox input&x



Please explain this...........i am new to vb script

Is This Answer Correct ?    0 Yes 0 No

Input = 124 output should be 124421 Please do not use any string functions/variables..

Answer / anil

input="421"
Dim arr(3)
arr(0)="4"
arr(1)="1"
arr(2)="2"
Set arrlist=CreateObject("system.collections.Arraylist")
For i=0 To UBound(arr)-1
arrlist.add arr(i)
Next
arrlist.sort
For i=0 To UBound(arr)-1
c= arrlist.item(i)
temp=temp&c




next
MsgBox temp&input

Is This Answer Correct ?    0 Yes 0 No

Input = 124 output should be 124421 Please do not use any string functions/variables..

Answer / pankaja yathindrakumar

'Input = 124 output should be 124421 Please do not use any string functions/variables
str="124"
Set r=New RegExp
r.pattern="."
r.Global=True
Set c= r.Execute(str)
For each key in c
t=key&t
Next
Msgbox str&t

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More VB Script Interview Questions

hi Set myobj=Description.Create() myobj("type").value="submit" myobj("name").value="google search" myobj("html tag").value="button" browser("title:=google").page("title:=google").webButton (myobj).Click i was running above code in one weak back it was working fine i got result,again i opened after few days ,again i was trying to run the code it shows run time error in last line of my code ,why ?pls answer my question?

0 Answers  


Explain the filter expression?

0 Answers  


How to write functions and sub in vb script?

0 Answers  


can anybody tell vb script code for alphanumeric and special character .which is used in qtp the name text field.

1 Answers  


Join the multiple array with out using JOIN function

1 Answers  






How to identify column in VSFlexgrid? My VSFlexgrid window is identified as 'Active X Control'

0 Answers  


What is the use of the date function in the vbscript language?

0 Answers  


accept a string & display whether a is present or not

1 Answers  


We have 1 web page with names column. I am giving the Service Providers1,2,3.... @ that time dynamically some no of names are displaying in the webpage and The Pop up windows are opening(No.of Pop Up windows=No.of Names). The names may be diffar for each and every Service Provders (Dynamically) How can we handle the Dynamic values?

0 Answers  


How can I access an object in another frame?

1 Answers  


Hi Friends, I am facing some issues with If,else condition,i.e. i am working on some web page for ex:gmail page.now if i want to check if username is incorrect or already exist,i want to display error message in my test report,for this i am using a simple code first,i.e. If Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set "Shekhar.g"= true Then Msgbox ("Username Does not Exist!") Else msgbox ("Welcome !") End If But still i am getting a syntax error If Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set "shekhar.g"= true Then Msgbox ("Username Does not Exist!") Else msgbox ("Welcome !") End If I don't feel any thing wrong in this syntax but i don't understand why it shows such error,i am confused what went wrong,please help me out & do the favor,thanks a lot....

1 Answers  


How are values assigned to string type and numeric type variables?

0 Answers  


Categories