Hi, Anybody could tell me What is the script for Reverse of
Given number. Ex:236--632. Thanks in Advance..

Answers were Sorted based on User's Feedback



Hi, Anybody could tell me What is the script for Reverse of Given number. Ex:236--632. Thanks in A..

Answer / deepak agrawal

int reverse=0;
while(digit)
{
reverse*=10;
reverse+=digit%10;
digit/=10;
}

Is This Answer Correct ?    12 Yes 2 No

Hi, Anybody could tell me What is the script for Reverse of Given number. Ex:236--632. Thanks in A..

Answer / bragaadeesh

public class RevNum {
public static void main(String args[]){
int sampleNum = 12345678;
System.out.println("Input Num : "+sampleNum);
int reversedNum = 0;
while(sampleNum!=0){
reversedNum = reversedNum*10 + sampleNum%10;
sampleNum = sampleNum/10;
}
System.out.println("Reversed Num : "+reversedNum);
}
}
//SAMPLE OUTPUT
//Input Num : 12345678
//Reversed Num : 87654321

Is This Answer Correct ?    5 Yes 0 No

Hi, Anybody could tell me What is the script for Reverse of Given number. Ex:236--632. Thanks in A..

Answer / srinu

dim str,cnt,rstr,i
str="236"
cnt=len(str)
for i=1 to cnt
rstr=mid(str,i,1) & rstr
next
msgbox rstr

Is This Answer Correct ?    5 Yes 0 No

Hi, Anybody could tell me What is the script for Reverse of Given number. Ex:236--632. Thanks in A..

Answer / amol zambre

str="236--678"
cnt=len(str)
for i=1 to cnt
rstr=mid(str,i,1) & rstr
next
msgbox rstr

Is This Answer Correct ?    1 Yes 0 No

Hi, Anybody could tell me What is the script for Reverse of Given number. Ex:236--632. Thanks in A..

Answer / test

dim a
a=StrReverse(123)
msgbox a

Is This Answer Correct ?    1 Yes 0 No

Hi, Anybody could tell me What is the script for Reverse of Given number. Ex:236--632. Thanks in A..

Answer / rohit_allinterview

int reverse(int num)
{
int temp,num2=0;
printf("Original number is %d",num);
while(num!=0)
{
temp=num%10;
num=num/10;

num2=num2+temp;
num2=num2*10;
}

num=num2/10;
printf("Reversed Number is %d",num);
}

// Incase of any mistake or doubt plz drop mailto
rohit_vit2020@yahoo.co.in

Is This Answer Correct ?    0 Yes 0 No

Hi, Anybody could tell me What is the script for Reverse of Given number. Ex:236--632. Thanks in A..

Answer / anonimous

public int reverse (int num){
String b = Integer.toString(num);
char [] aa = b.toCharArray();
char []cc = new char [aa.length];
for (int m = 0; m < aa.length; m++)
cc[m] = aa[aa.length - 1 - m];

return Integer(String.valueOf(cc));
}

Is This Answer Correct ?    0 Yes 0 No

Hi, Anybody could tell me What is the script for Reverse of Given number. Ex:236--632. Thanks in A..

Answer / parvez

'You can reverse any string with char, num and spl
characters with this code!

Sub StinrgReverse()

Dim sString, sRevString

sString = InputBox("Enter your string: ")
MsgBox sString
sRevString = fStringReverse(sString)
MsgBox sRevString
End Sub

Function fStringReverse(ByVal sBeforeRev)

Dim aStrSplit, sAfterSplit, sAfterRev, aStrRev

iLength = Len(sBeforeRev) - 1
ReDim aStrSplit(iLength) 'Very Important

For i = 0 To iLength
aStrSplit(i) = Mid(sBeforeRev, i + 1, 1)
Next

ReDim aStrRev(iLength) 'Very Important
For j = 0 To iLength
aStrRev(j) = aStrSplit(iLength - j)
Next

sAfterSplit = Join(aStrSplit, ".")
sAfterRev = Join(aStrRev, ".")
sAfterRev = Replace(sAfterRev, ".", "")
fStringReverse = sAfterRev

End Function

Is This Answer Correct ?    0 Yes 0 No

Hi, Anybody could tell me What is the script for Reverse of Given number. Ex:236--632. Thanks in A..

Answer / anwar basha

str="236"

for i=1 to len(str)
a=right(str,i)
temp=temp&left(a,1)
next
msgbox temp

Is This Answer Correct ?    0 Yes 1 No

Hi, Anybody could tell me What is the script for Reverse of Given number. Ex:236--632. Thanks in A..

Answer / suryanarayan mohanty

Suppose we have number say 123
to find the revesrse of this number use
StrReverse(123).

Is This Answer Correct ?    2 Yes 7 No

Post New Answer

More VB Script Interview Questions

what is the differance between BYVAL,BYREF?

0 Answers  


accept an email id & validate it .email id should not exceed 25 characters the mail id should contain 3 characters excluding domain name,@ and .(dot) the last 3 characters of the domain should be net,com or org

2 Answers  


Explain about arrays in vb script?

0 Answers  


wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......

0 Answers  


What is the difference between VBScript and JavaScript?

0 Answers  






Explain few date functions in vbscript?

0 Answers  


What is the differene between QTP 8.2 and QTP 9.0 and QTP 9.1,Pls give me answer ASAP.

3 Answers   Accenture,


how to organize files in object repository of qtp

1 Answers  


I have a webtable and many objects are embedded in side.(like buttons,checkboxes etc). How to know how many such objects are there? what is the class of that objects?

1 Answers   HP, TCS,


How to pass the parameter from one function to another function in VB Scripting?

1 Answers   Fastenal,


How can you create an object in vbscript?

0 Answers  


Am working with web application. i faced one senario. i.e, webpage having webtable having two coloumns, in that first coloumn is for serial no and second coloumn is for mac address link, now i want to get first row second coloumn value, that having macaddress as link. Please help me how to get that link?

2 Answers  


Categories