0% found this document useful (0 votes)
2 views3 pages

HTML All Programs PART-4

The document contains a series of VBScript program examples designed for a 12th-grade computer science class. Each example demonstrates different functionalities such as mathematical operations, conditional statements, and string manipulations. The programs are structured in HTML format with specific titles indicating their purpose.

Uploaded by

kmotewar2009
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

HTML All Programs PART-4

The document contains a series of VBScript program examples designed for a 12th-grade computer science class. Each example demonstrates different functionalities such as mathematical operations, conditional statements, and string manipulations. The programs are structured in HTML format with specific titles indicating their purpose.

Uploaded by

kmotewar2009
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Dinesh Sir’s ROBOTECH 12th COMPUTER SCIENCE CLASS, Bhagya Nagar, Nanded.

9075361916, 9422174708
VB Script Programs [ Every program aim is provided under <title> tag ]
Example 1:
<html>
<head>
<title>Program to get 1 number input and print it's square and cube</title>
</head>
<body>
<script language="vbscript">
a=inputbox("enter 1 number ")
[Link] "number " & a & "<br>"
[Link] "square " & a*a & "<br>"
[Link] "cube " & a*a*a
</script>
</body>
</html>

Example 2:
<html>
<head>
<title>Program to get 2 numbers input and perform mathematical operations on it</title>
</head>
<body>
<script language="vbscript">
a=inputbox("enter 1st number ")
b=inputbox("enter 2nd number ")
[Link] "addition " & a*1+b*1 & "<br>"
[Link] "subtraction " & a-b & "<br>"
[Link] "multiplication " & a*b & "<br>"
[Link] "division " & a/b & "<br>"
</script>
</body>
</html>

Example 3:
<html>
<head>
<title> Program to get 3 SUBJECT MARKS AS INPUT AND PRINT TOTAL AND AVG MARKS </title>
</head>
<body>
<script language="vbscript">
sub1=inputbox("enter 1st subject marks ")
sub2=inputbox("enter 2nd subject marks ")
sub3=inputbox("enter 3rd subject marks ")
total=sub1*1+sub2*1+sub3*1
avg=total/3
[Link] "total marks "& total & "<br>"
[Link] "avg marks "& avg
</script>
</body>
</html>
Dinesh Sir’s ROBOTECH 12th COMPUTER SCIENCE CLASS, Bhagya Nagar, Nanded. 9075361916, 9422174708
Example 4:
<html>
<head>
<title> Program to get 1 number input and check whether it is positive or negative number </title>
</head>
<body>
<script language="vbscript">
num=inputbox("enter 1 number ")
if num>0 then
[Link] "positive number "
else
[Link] "negative number "
end if
</script>
</body>
</html>

Example 5:
<html>
<head>
<title> Program to get 1 number input and check whether it is even or odd number </title> </head>
<body>
<script language="vbscript">
num=inputbox("enter 1 number ")
if num mod 2=0 then
[Link] "even number "
else
[Link] "odd number "
end if
</script>
</body>
</html>

Example 6:
<html>
<head> <title> Program to get age as input and check whether he is child, young or old </title> </head>
<body>
<script language="vbscript">
age=inputbox("enter age ")
if age<=12 then
[Link] "child "
elseif age<=19 then
[Link] "teen age "
elseif age<=50 then
[Link] "young "
else
[Link] "old "
end if
</script>
</body> </html>
Dinesh Sir’s ROBOTECH 12th COMPUTER SCIENCE CLASS, Bhagya Nagar, Nanded. 9075361916, 9422174708
Example 7:
<html>
<head> <title>date and time function</title> </head>
<body>
<script language="vbscript">
[Link] now()&"<br>"
[Link] date()&"<br>"
[Link] time()&"<br>"
[Link] weekdayname(weekday(date()))&"<br>"
[Link] weekday(date())&"<br>"
[Link] day(date())&"<br>"
[Link] month(date())&"<br>"
[Link] monthname(month(date()))&"<br>"
[Link] year(date())&"<br>"
[Link] hour(time())&"<br>"
[Link] minute(time())&"<br>"
[Link] second(time())&"<br>"
</script>
</body>
</html>

Example 8:
<html>
<head> <title>math function</title> </head>
<body>
<script language="vbscript">
[Link] sqr(5)&"<br>"
[Link] abs(-3)&"<br>"
[Link] round(3.5)&"<br>"
[Link] log(2)&"<br>"
[Link] sin(2)&"<br>"
[Link] cos(2)&"<br>"
[Link] tan(2)&"<br>"
</script>
</body>
</html>
Example 9:
<html>
<head> <title>string function</title> </head>
<body>
<script language="vbscript">
t="computer SCIENCE class"
[Link] t&"<br>"
[Link] len(t)&"<br>"
[Link] lcase(t)&"<br>"
[Link] ucase(t)&"<br>"
[Link] mid(t,10,5)&"<br>"
s="this is nice"
[Link] replace(s," is", " was")&"<br>"
[Link] INSTR(t,"put")&"<br>"
[Link] asc("a")&"<br>"
[Link] chr(98)&"<br>"
</script>
</body> </html>

You might also like