Thursday, April 19, 2012

VB Script -Programs

  1. *
    **
    ***
    Please write a code to get output like above diagram.
for i=1 to 3 step 1
  for j=1 to i step 1
    vstr=vstr&"*"
  next
   vstr=vstr&vbnewline
next
msgbox vstr
  1. sunday is sunday
    monday
    tuesday
    wendesday
    sunday
    thursday
    friday
    saturday
    sunday
    sunday

    how to count no of sunday in the text file from vb?
Set fso=createobject("scripting.filesystemobject")
Set forread=fso.OpenTextFile("path\test.txt",1)
text=forread.ReadAll
coun=ubound(split(text,"sunday"))
msgbox coun

3. int a=4857 i need output as 7584.without using any inbuild function?
var=4857 For i=1 to len(var) x=var mod 10 num=num&x var=var/10 var=fix(var) Next msgbox num