Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
5Activity
0 of .
Results for:
No results containing your search query
P. 1
VBScript Examples

VBScript Examples

Ratings: (0)|Views: 835|Likes:
Published by G.C.Reddy
VB Script general examples
VB Script general examples

More info:

Published by: G.C.Reddy on Feb 13, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC or read online from Scribd
See more
See less

08/19/2010

 
For more Scripts & QTP Documents Visit: www.gcreddy.com
VBScript General Examples
www.gcreddy.com
For Software Testing Documents visit:
ww.gcreddy.net
1
 
For more Scripts & QTP Documents Visit: www.gcreddy.com
1) Write a program for finding out whether the given year is a leap year ornot?
Dim xyearxyear=inputbox ("Enter Year")If xyear mod 4=0 Thenmsgbox "This is a Leap year"Elsemsgbox "This is NOT"End If 
2) Write a program for finding out whether the given number is, Evennumber or Odd number?
Dim numnum=inputbox ("Enter a number")If num mod 2=0 Thenmsgbox "This is a Even Number"Elsemsgbox "This is a Odd Number"End If 
3) Read two numbers and display the sum?
Dim num1,num2, sumnum1=inputbox ("Enter num1")num2=inputbox ("Enter num2")sum= Cdbl (num1) + Cdbl (num2) 'if we want add two strings conversionrequiremsgbox ("Sum is " &sum)
4) Read P,T,R values and Calculate the Simple Interest?
Dim p,t, r, sip=inputbox ("Enter Principle")t=inputbox ("Enter Time")r=inputbox ("Enter Rate of Interest")si= (p*t*r)/100 ' p= principle amount, t=time in years, r= rate of interestmsgbox ("Simple Interest is " &si)
5) Read Four digit number, calculate & display the sum of the number ordisplay Error message if the number is not a four digit number?
Dim num, sumnum=inputbox ("Enter a Four digit number")If Len(num) = 4 Thensum=0sum=sum+num mod 10num=num/10num= left (num, 3)
For Software Testing Documents visit:
ww.gcreddy.net
2
 
For more Scripts & QTP Documents Visit: www.gcreddy.com
sum=sum+num mod 10num=num/10num= left (num, 2)sum=sum+num mod 10num=num/10num= left (num, 1)sum=sum+num mod 10msgbox ("Sum is " &sum)elsemsgbox "Number, you entered is not a 4 digit number"End If 
6) Read any Four-digit number and display the number in reverse order?
Dim num,revnum= inputbox("Enter a number")If len(num)=4 Thenrev=rev*10 + num mod 10num=num/10num= left(num,3)rev=rev*10 + num mod 10num=num/10num= left(num,2)rev=rev*10 + num mod 10num=num/10num= left(num,1)rev=rev*10 + num mod 10msgbox "Reverse Order of the number is "&revElsemsgbox "Number, you entered is not a 4 digit number"End If 
7) Read 4 subjects marks; calculate the Total marks and grade?
(a) If average marks Greater than or equal to 75, grade is Distinctionb) If average marks Greater than or equal to 60 and less than 75 , then grade isFirstc) If average marks Greater than or equal to 50 and less than 60 , then grade isSecondd) If average marks Greater than or equal to 40 and less than 50 , then grade isThirde) Minimum marks 35 for any subject, otherwise 'no grade fail')Dim e,m,p,c, tote=inputbox ("Enter english Marks")m=inputbox ("Enter maths Marks")p=inputbox ("Enter physics Marks")c=inputbox ("Enter chemistry Marks")
For Software Testing Documents visit:
ww.gcreddy.net
3

Activity (5)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
anshulkharub liked this
kmdasari liked this
92saif liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->