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
Answer / deepak agrawal
int reverse=0;
while(digit)
{
reverse*=10;
reverse+=digit%10;
digit/=10;
}
| Is This Answer Correct ? | 12 Yes | 2 No |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Consider there are objects in a webapp which are identified by QTP. Suppose you know only the logical name of a object(absolutely nothing else about it). Which approach will you take to find the "micClass" of the object(You can't use Object Spy, or can't add the object in repository)?
we executed QTP scripts in one browser(i.e IN)same scripts is working on another browsers or not (i.e mean netscap,m azol..like )
how to automatically update the sql server2005 database records when insert in vb6?
what is diff b/n these 2 programs 1) for i=5 to 1 step 2 msgbox "pass" next 2_) for i=5 to 1 step -2 msgbox "pass" next
In the Web page we have a table link, if we click on that link all the contents under that link will be sorted (asscending/Descending). Now i want to check in which order the list is ? for that i need to get the data in to some var How can i get that cells data?
Explain about the extension .hta?
When importing an excel file that has several columns each with different number of rows into QTP's Global datatable, how can you count the number of rows in a particular column?
3 Answers Logica CMG, McGraw Hill,
Write a VB Script to count blank Lines in a notepad
write a vb script to calculate factorial of a number?
this q asked in applabs, q is: QTP should open google.com page and enter "qtp" in one edit(search) box and click search and should open google.com again and enter "job" in edit(search) box and click on search. I tried this but getting error "Edit(search) box matches more than one object", could anyone this question plz..
What is the use of option explicit statement?
How can constants be declared in the vbscript language?