Escolar Documentos
Profissional Documentos
Cultura Documentos
1) Write a program for finding out whether the given year is a leap year or not?
Dim xyear
xyear=inputbox ("Enter Year")
If xyear mod 4=0 Then
msgbox "This is a Leap year"
Else
msgbox "This is NOT"
End If
2) Write a program for finding out whether the given number is, Even number or Odd
number?
Dim num
num=inputbox ("Enter a number")
If num mod 2=0 Then
msgbox "This is a Even Number"
Else
msgbox "This is a Odd Number"
End If
Dim p,t, r, si
p=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 interest
msgbox ("Simple Interest is " &si)
5) Read Four digit number, calculate & display the sum of the number or display Error
message if the number is not a four digit number?
6) Read any Four-digit number and display the number in reverse order?
Dim num,rev
num= inputbox("Enter a number")
If len(num)=4 Then
rev=rev*10 + num mod 10
num=num/10
num= left(num,3)
rev=rev*10 + num mod 10
num=num/10
num= left(num,2)
rev=rev*10 + num mod 10
num=num/10
num= left(num,1)
rev=rev*10 + num mod 10
msgbox "Reverse Order of the number is "&rev
Else
msgbox "Number, you entered is not a 4 digit number"
End If
Dim num,n
n=Inputbox ("Enter a Vaule")
For num= 1 to n step 2
msgbox num
Next
Dim num,n
n=Inputbox ("Enter a Vaule")
For num= 2 to n step 2
msgbox num
Next
Dim num,n
n=Inputbox ("Enter a Vaule")
For num=n to 1 step -1
msgbox num
Next
16) Verify weather the entered 10 digit value is a numeric value or not?
Dim a,x,y,z,num
num=Inputbox ("Enter a Phone Number")
d1= left (num,1)
d10=Right (num,1)
d2=mid (num, 2, len (1))
d3=mid (num, 3, len (1))
d4=mid (num, 4, len (1))
d5=mid (num, 5, len (1))
d6=mid (num, 6, len (1))
d7=mid (num, 7, len (1))
d8=mid (num, 8, len (1))
d9=mid (num, 9, len (1))
If isnumeric (d1) = "True" and isnumeric (d2) = "True" and isnumeric (d3) = "True" and isnumeric
(d4) = "True"and isnumeric (d5) = "True"and isnumeric (d6) = "True"and isnumeric (d7) =
"True"and isnumeric (d8) = "True"and isnumeric (d9) = "True"and isnumeric (d10) = "True" Then
17) Verify weather the entered value is a 10 digit value or not and Numeric value or not?
(Using multiple if conditions)
Dim a,x,y,z,num
num=Inputbox ("Enter a Phone Number")
d1= left (num,1)
d10=Right (num,1)
d2=mid (num, 2, len (1))
d3=mid (num, 3, len (1))
d4=mid (num, 4, len (1))
d5=mid (num, 5, len (1))
d6=mid (num, 6, len (1))
d7=mid (num, 7, len (1))
d8=mid (num, 8, len (1))
d9=mid (num, 9, len (1))
If isnumeric (d1) = "True" and isnumeric (d2) = "True" and isnumeric (d3) = "True" and isnumeric
(d4) = "True"and isnumeric (d5) = "True"and isnumeric (d6) = "True"and isnumeric (d7) =
"True"and isnumeric (d8) = "True"and isnumeric (d9) = "True"and isnumeric (d10) = "True" Then
msgbox "It is a Numeric Value"
End If
End If
18) Generate interest for 1 to 5 years (for 1 year -7%, 2 years -8%, 3 years-9%, 4 years-
10%, 5 years -11%)
Dim amount, duration, intr
amount=inputbox("enter amount")
If amount<10000 Then
msgbox "low amount"
else
For duration=1 to 5
If duration=1 Then
intr=amount*7/100
msgbox "1 year intrest is: " &intr
20) Read a value and find whether the value is numeric or not?
21) Read a value and find whether the value is Date type data or not?
22)Read a value and Verify whether the value is 10-digit number or not and
started with 9 0r 8.
Else
msgbox val&" is not a valid mobile number "
End If
Else
msgbox val& " is Invalid data"
End If
24) Read a Value and Verify weather the value is started with Alfa bytes or
not? (First letter should be Alfa byte)
val=Inputbox("enter a value")
val_Asc=Asc(val)
Msgbox val_Asc
If val_Asc>=65 and val_Asc<=90 or val_Asc>=97 and val_Asc<=122Then
msgbox val&" is an Alphabet"
Else
msgbox val&" is not an Alphabet"
End If
25) Read a value and Verify weather the value is Alfa bytes are not?