0% found this document useful (0 votes)
37 views5 pages

Chapter 9 and 10 Small Basic Programs

The document contains 20 programs written in pseudocode. The programs demonstrate basic programming concepts like displaying text, accepting user input, performing mathematical operations, conditional statements, and type checking. They cover topics such as hello world, name greeting, addition, subtraction, multiplication, division, simple interest calculation, area and perimeter of a circle, finding the square of a number, comparing numbers, converting units, calculating percentage, and determining if a number or character is even, odd, divisible by 5, alphabetic or a digit.
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)
37 views5 pages

Chapter 9 and 10 Small Basic Programs

The document contains 20 programs written in pseudocode. The programs demonstrate basic programming concepts like displaying text, accepting user input, performing mathematical operations, conditional statements, and type checking. They cover topics such as hello world, name greeting, addition, subtraction, multiplication, division, simple interest calculation, area and perimeter of a circle, finding the square of a number, comparing numbers, converting units, calculating percentage, and determining if a number or character is even, odd, divisible by 5, alphabetic or a digit.
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
You are on page 1/ 5

Program 1: Write a program to display ‘Hello World’

TextWindow.WriteLine("Hello World")

Program 2: Write a program to accept a name and display “Good Morning”


message
TextWindow.WriteLine("Please enter your name")
name=textwindow.Read()
TextWindow.WriteLine("Good Morning "+name)

Program 3 Write a program to accept two numbers (store in variable a and b)


and show addition a+b
TextWindow.WriteLine("Please enter first number ")
a=textwindow.Read()
TextWindow.WriteLine("Please enter seconds number ")
b=textwindow.Read()
c=a+b
TextWindow("Answer is "+c)

Program 4: Write a program to accept two numbers (store in variable a and b)


and show subtraction a-b
TextWindow.WriteLine("Please enter first number ")
a=textwindow.Read()
TextWindow.WriteLine("Please enter seconds number ")
b=textwindow.Read()
c=a-b
TextWindow("Answer is "+c)

Program 5 Write a program to accept two numbers (store in variable a and b)


and show Multiplication a*b
TextWindow.WriteLine("Please enter first number ")
a=textwindow.Read()
TextWindow.WriteLine("Please enter seconds number ")
b=textwindow.Read()
c=a*b
TextWindow("Answer is "+c)
Program 6: Write a program to accept two numbers (store in variable a and b)
and show division a/b
TextWindow.WriteLine("Please enter first number ")
a=textwindow.Read()
TextWindow.WriteLine("Please enter seconds number ")
b=textwindow.Read()
c=a/b
TextWindow("Answer is "+c)

Program 7: Write a program to find simple interest (take P,R,T as variables)


𝑷×𝑹×𝑻
formula
𝟏𝟎𝟎
TextWindow.WriteLine("Please enter principal amount")
P=textwindow.Read()
TextWindow.WriteLine("Please enter rate of interest")
R=textwindow.Read()
TextWindow.WriteLine("Please enter time in years")
T=textwindow.Read()
ans=P*R*T/100
TextWindow.WriteLine("Simple interest is "+ans)

Program 8: Write a program to find area and perimeter of a circle


(take radius variable)
(formula Area= πr2)
(formula perimeter= 2πr)
TextWindow.WriteLine("Enter Radius")
r=textwindow.Read()
area=3.14*r*r
perimeter=2*3.14*r
TextWindow.WriteLine("Area is "+area)
TextWindow.WriteLine("Perimeter is "+perimeter)

Program 9: Write a program to find square of a number


TextWindow.WriteLine("Please enter a number")
num=TextWindow.Read()
square=num*num
TextWindow.WriteLine("Square is "+square)
Program 10: Write a program to find maximum out of two number
TextWindow.WriteLine("Please enter first number")
a=TextWindow.Read()
TextWindow.WriteLine("Please enter second number")
b=TextWindow.Read()
TextWindow.WriteLine("Maximum is "+math.Max(a,b))

Program 11: Write a program to convert Kilometer to miles.


TextWindow.WriteLine("Please enter distance in kilometer")
km=TextWindow.Read()
miles=km*0.625
TextWindow.WriteLine("Distance in miles "+miles)

Program 12: Calculate the percentage of attendance of a student


(Percentage of attendance of student = Number of days a student is present / Total
number of days in a month * 100)
TextWindow.WriteLine("Please enter days students was present")
present=TextWindow.Read()
total_days=134
Per=(present/total_days)*100
TextWindow.WriteLine("Attendance is "+Per)

Program 13: Write a program to find if a number is bigger than 10 or not.


TextWindow.WriteLine("Please enter a number")
num=TextWindow.Read()
if num>10 then
TextWindow.WriteLine("Number is bigger than 10")
else
TextWindow.WriteLine("Number is not bigger than 10")
endif

Program 14: Write a program to find out if entered number is positive.


TextWindow.WriteLine("Please enter a number")
num=TextWindow.Read()
if num>0 then
TextWindow.WriteLine("Positive")
endif
Program 15: Write a program to check if person is adult or not
TextWindow.WriteLine("Please enter your age")
age=TextWindow.Read()
if age>=18 then
TextWindow.WriteLine("Person is adult")
else
TextWindow.WriteLine("Person is not adult")
endif

Program 16: Write a program to check entered character is vowel or


consonant.
TextWindow.WriteLine("Please enter a character")
ch=TextWindow.Read()
if (ch="a" or ch="e" or ch="i" or ch="o" or ch="u") then
TextWindow.WriteLine("Vowel")
else
TextWindow.WriteLine("Consonant")
endif

Program 17: Write a program to print message according to percentage


entered. If percentage is more than 80 print “Good Performance” else print
“Average Performance”.
TextWindow.WriteLine("Please enter your percentage")
perc=TextWindow.Read()
if perc>80 then
TextWindow.WriteLine("Good Performance")
else
TextWindow.WriteLine("Average Performance")
endif
Program 18 Write a program to find if entered number is divisible by 5 or not.
TextWindow.WriteLine("Please enter a number")
num=TextWindow.Read()
rem=Math.Remainder(num,5)
if rem=0 then
TextWindow.WriteLine("Divisible by 5")
else
TextWindow.WriteLine("Not Divisible by 5")
endif
Program 19: Write a program to check if entered number is odd or even.
TextWindow.WriteLine("Please enter a number")
num=TextWindow.Read()
rem=Math.Remainder(num,2)
if rem=0 then
TextWindow.WriteLine("Even")
else
TextWindow.WriteLine("Odd")
endif

Program 20: Write a program to check if entered character is alphabet or


digit.
TextWindow.WriteLine("Please enter character")
ch=TextWindow.Read()
if (ch>="A" and ch<="Z") or (ch>="a" and ch<="z") then
TextWindow.WriteLine("Alpahbet")
else
TextWindow.Write("Digit")
endif

You might also like