Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VBscript for Triangle reverse
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Experts,
Can you please answer this question, I searched in google and not able to find ..

Output should be:
54321
5432
543
54
5

Thanks in advance
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Hopefully this is what you were looking for?

Code:
strVal = 54321
For IntCounter = len(strVal) to 0 step -1
msgbox Left(strVal,IntCounter)
Next
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Basanth27,
Thanks a lot for your quick response.

Your code is working fine and its giving the result as line by line (as 1st it display 54321 after 5432 after 543 after 54 after 5 )
But I want the logic , all the results should display at at time like
54321
5432
543
54
5
Can you please solve this ...Thanks
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
Okay. Was this what you wanted?
Code:
strVal = 54321
for IntIcounter = len(strVal) to 1 step -1
strInd=  Left(strVal,IntIcounter)
strFinal = strFinal + strInd &VBCRLF
Next
msgbox strFinal
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#5
Solved: 10 Years, 8 Months, 3 Weeks ago
Excellent Basanth,
It's working fine..
Thanks a Ton for the Help .
Reply
#6
Solved: 10 Years, 8 Months, 3 Weeks ago
Happiness is contagious Smile Thank you. Have a good weekend.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)