1. Write a
program using sub procedure to find the area of scalene triangle.
Declare Sub area (a, b, c)
Cls
Input “Enter 1stside”; a
Input “Enter 2nd side”; b
Input “Enter 3rd side”; c
Call area (a, b, c)
End
Sub area (a, b, c)
S=(a+b+c)/3
Area=s*(s-a) *(s-b) *(s-c) ^ (1/2)
Print “The area of the Scalene triangle
is”; area
2.
Write a program using sub procedure to find
distance travelled of an object
Declare Sub Distance (u, t, a)
Cls
Input “Enter the initial velocity”; u
Input “Enter the acceleration”; a
Input “Enter the time taken”’; t
Call distance (u, t, a)
End
Sub distance (u, t, a)
S=u*t+(1/2) *a*t^2
Print “The distance travelled of an object
is”; S
End sub
3.
Write a program using sub procedure to find the
area of circle
Declare sub Circle (r)
Cls
Input “Enter the radius”; r
Call Circle (r)
End
Sub Circle (r)
Area= (22/7) *r^2
Print “The area of Circle is”; Area
end sub
4.
Write a program using sub procedure to find
Simple Interest
Declare Sub Interest (P, T, R)
Cls
Call Interest (P, T, R)
End
Sub interest (P, T, R)
S. I=(P*T*R)/100
Print “The Simple Interest is”; S.I
End sub
5.
Write a program using procedure to find the
volume of the box
Declare sub volume (l, b, h)
Cls
Input “Enter three numbers”; l, b, h
Call volume (l, b, h)
End
Sub volume (l, b, h)
V=l*b*h
Print “The volume of the box”; v
End sub
16. Write
a program using sub procedure to find the area of right angle triangle.
Declare sub triangle (b, h)
Cls
Input “Enter the bade of the triangle”; b
Input “Enter the height of the triangle”; h
Call triangle (b, h)
End
Sub triangle (b, h)
Area= (1/2) *b*h
Print” The area of the triangle”; area
End sub
17. Write
a program using sub procedure to input string and show reverse of it.
Declare sub reverse(a$)
Cls
Input “Enter the string”; a$
Call reverse(a$)
End
Sub reverse(a$)
For I= Len(a$) to 1 step -1
M$=m$+mid$(a$, I,1)
Next I
Print “the reverse of the string”; m$
End sub
18. Write
a program using sub procedure to input a string and check whether the string is
palindrome or not.
Declare sub Palindrome(a$)
Cls
Input “Enter the string”; a$
Call palindrome(a$)
End
Sub palindrome(a$)
For I=Len(a$) to 1 step -1
M$=m$+mid$(a$, I,1)
Next I
If m$=a$ then
Print “This string is palindrome”
Else
Print “This is not palindrome”
End if
End sub
19. Write
a program using sub procedure to input a string and display the vowel
characters.
Declare sub Vowel(a$)
Cls
Input “enter any word”; a$
Call vowel(a$)
End
Sub vowel(a$)
A$=ucase$(a$)
For x=1 to Len(a$)
M$=mid$(a$, x,1)
If m$=” A” or m$=” E” or m$=” I” or m$=” O”
or m$=” U”
Then
C$=c$+m$
End if
next x
Print “the vowel is“; C$
End sub
20. Write
a program using sub procedure to input a string and count the numbers of vowel
characters form the given string.
Declare sub Vowel(a$)
Cls
Input “enter any word”; a$
Call vowel(a$)
End
Sub vowel(a$)
A$=ucase$(a$)
For x=1 to Len(a$)
M$=mid$(a$, x,1)
If m$=” A” or m$=” E” or m$=” I” or m$=” O”
or m$=” U”
Then
C=c+1
End if
next x
Print “the vowel is“; C
End sub
21. Write
a program using sub procedure to input a string and display the
consonantcharacters from the given data.
Declare sub consonant(a$)
Cls
Input “enter any word”; a$
Call consonant(a$)
End
Sub consonant(a$)
A$=ucase$(a$)
For x=1 to Len(a$)
M$=mid$(a$, x,1)
If m$<>” A” and m$<>” E” and
m$<>” I” and m$<>” O” and m$<>” U”
Then
C$=c$+m$
End if
next x
Print “the vowel is“; C$
End sub
22. Write
a program using sub procedure to input a string and display with alternate.
Declare sub alternate(a$)
Cls
Input “enter any word”; a$
Call alternate(a$)
End
Sub alternate(a$)
For x=1 to Len(a$)
M$=mid$(a$, x,1)
If X mod 2=0 then
B$=B$+Lcase$(a$)
Else
B$=B$+Ucase$(a$)
End if
next
x
Print “the alternate is“; C$
End sub
23. Write a program using sub procedure to input a number check odd or even
23. Write a program using sub procedure to input a number check odd or even
Declare sub number(a)
Cls
Input “Enter any number”; a
Call number(a)
End
sub number(a)
if a mod 2=0
then
print “Even”
else
print “Odd”
end if
end sub
24.
Write a program using sub procedure to input and
check whether it is positive, Negative or Zero.
Declare sub number(a)
Cls
Input “Enter any number”; a
Call number(a)
End
Sub number(a)
If n>0 then
Print “Positive number”
Else if N<0 then
Print “Negative number”
Else
Print” Zero””
End if
End sub
25.
Write a program using sub procedure to input a number
and check whether it is exactly divisible by 13 or not?
Declare sub number(a)
Cls
Input “Enter any number”; a
Call number(a)
End
Sub number(a)
If a mod 13=0
then
Print “The number is divisible”
Else
Print “The number is not divisible”
End if
End sub
26.
Write a program using sub procedure to input any
string and display longest string among two.
Declare sub strings(a$, b$)
Cls
Input “Enter two string”; A$, b$
Call strings(a$,
b$)
End
Sub strings(a$,
b$)
If Len$(a$) >Len$(b$) then
Print a$;”is longest”
Else
Print b$;”is longest”
End if
End sub
27.
Write a program using sub procedure to input
number and check whether it is exactly divisible by 19 and 29 or not?
Declare sub number(a)
Cls
Input “Enter any number”; a
Call number(a)
End
Sub number(a)
If a mod 19=0
and a mod 29=0
then
Print “The number is divisible”
Else
Print “The number is not divisible”
End if
End sub
28.
Write a program using sub procedure to find
greatest number among two digits.
Declare sub number(a, b)
Cls
Input “Enter two number”; a, b
Call number(a,
b)
End
Sub number(a,
b)
If a>b then
Print a; “is the greatest”
Else
Print b; “is greatest”
End if
End sub
29.
Write a program using sub procedure to find
smallest among two digits.
Declare sub number(a, b)
Cls
Input “Enter two number”; a, b
Call number(a,
b)
End
Sub number(a,
b)
If a<b then
Print a; “is the smallest”
Else
Print b; “is smallest”
End if
End sub
30.
Write a program using sub procedure to input
three different number and find the greatest number.
Declare sub number(a, b, c)
Cls
Input “Enter two numbers”; a, b, c
Call number(a,
b, c)
End
Sub number(a,
b, c)
If a>b and a>c then
Print a; “is the greatest”
Else if b>a and b>c then
Print b; “is greatest”
Else
Print b; “is greatest”
End if
End sub
31.
Write a program using sub procedure to input
three different number and find the smallest number.
Declare sub number(a, b, c)
Cls
Input “Enter two number”; a, b, c
Call number(a,
b, c)
End
Sub number(a,
b, c)
If a<b and a<c then
Print a; “is the smallest”
Else if b<a and b<c then
Print b;”is smallest”’
Else
Print c; “is smallest”
End if
End sub
32.
Write a program using sub procedure to input
three different number and find the middle number.
Declare sub number(a, b, c)
Cls
Input “Enter two numbers”; a, b, c
Call number(a,
b, c)
End
Sub number(a,
b, c)
If (a>b
and a>c) or
(a<b
and a>c) then
Print a; “is the middle number”
Else if (b>a
and b>c) or
(b<a
and b>c) then
Print b; “is middle number”
Else
Print b; “is middle number”
End if
End sub
33.
Write a
program using sub procedure to show long string among three strings
Declare sub string(a$, b$, c$)
Cls
Input “Enter 1st string”; a$
Input “enter 2ndstring$
Input “Enter 3rdstring$
Call string(a$,
b$, c$)
End
Sub string(a$,
b$, c$)
If Len(a$)>Len$(b$) and$(a$)>Len$(c$) then
Print a$; “is the longest string”’
Else if Len$(b$)>Len$(a$) and Len$(b$) >Len$(c$) then
Print b; “is the longest string”
Else
Print c$; “is the longest string”
End if
End sub
34.
Write a program using sub procedure to show
middle string among three strings
Declare sub string(a$, b$, c$)
35.
Write a program using sub procedure to input a
string display the odd characters.
Declare sub odd(a$)
Cls
Input “Enter the string”; a$
Call odd(a$)
End
Sub odd(a$)
For x=1
to Len(a$)
C$=mid$(a$, I,1)
If x mod 2<> 0 then
M$=m$+e$
End if
Next x
Print “The odd characters”; m$
end sub
36.
Write a program using sub procedure to input a
string display the even character.
Declare sub even(a$)
Cls
Input “Enter the string”; a$
Call even(a$)
End
Sub even(a$)
For x=1 to Len(a$)
E$=mid$(a$, x,1)
If x md 2=0 then
M$=m$+e$
Else if
Next x
Print “The even characters”; m$
End sub
37.
Write a program using sub procedure to input
string character and check the occurrences of the characters in given string.
Declare sub strings (a$, b$)
Input “Enter any string”; a$
Input “Enter occurrences”; b$
Call strings (a$, b$)
End
Sub strings (a$, b$)
a$=Ucase$(a$)
b$=ucase$(b$)
for x = 1 to Len(a$)
m$=mid$(a$, x,1)
if m$=b$ then
c=c+1
end if
next x
print “The occurrence is :";c
end sub
38.
Write a program using sub procedure to input
string and check vowel occurrencecharacters.
Declare sub string(a$)
Cls
Input “Enter a string”; a$
Call string(a$)
End
Sub string(a$)
a$=ucase$(a$)
m$=mid$(a$, x,1)
if m$=” A” then
b=b+1
else if m$=” E” then
c=c+1
else if m$=” I” then
d=d+1
else if m$=” O” then
f=f+1
else if m$=” U” then
g=g+1
end if
next x
print “A:”; b
print “E:”; c
print “I:” d
print “O:” f
print “U:”; g
end sub
Prepared by :-
sunarrajesh25@gmail.com
Saurav Sunar
Class:-10
Spiral Galaxy Higher Secondary School