Write a program to display the numbers in the below format using for loops?
1 2 3 4
5 6 7 8
9 10 11 12
and
Write a program to display the numbers in the below format using for loops.
1
2 3
4 5 6
7 8 9 10

Answer Posted / prathyusha

num=0
For i=1 To 4
For j=1 To i
num=num+1
val=val&num
Next
res=res&vbCrLf&val
val=""
Next
MsgBox res

o/p
******
1
23
456
78910
************************
num=0
For i=1 To 3
For j=1 To 4
num=num+1
val=val&num
Next
res=res&vbCrLf&val
val=""
Next
MsgBox res

o/p
*******
1234
5678
9101112

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which command is used for writing text on a page?

574


Difference between dim,public and private variables in vb script?

525


Mention the rules for using option explicit statement?

482


What are the 2 ways to pass a value to the function?

511


Which operator can be used to do an xor operation in vbscript?

676






Mention what is the use of option explicit in vbscript?

547


Both Static and dynamic arrays are handled by VB script. Is it true?

608


Can anyone send me a vb script function for verifying the functionality of active links on a web page

1596


filter the array values without using filter function?

1655


What is Procedure or Subroutine in VB Script?

600


What is the difference between vbscript and vba?

598


Why is error handling required?

569


How to replace junk code recorded by QTP with a mall function.

1646


What are class events?

581


How will you get the largest subscript of an array in vbscript?

603