Algorithms Updated
Algorithms Updated
numbers
Step 1: start
Step 2: Declare the variables a, b, c, d, e, sum, prod, avg
Step 3: Read the value of a, b, c, d, e
Step 4: calculate sum, product and average
sum=a+b+c+d+e;
prod=a*b*c*d*e;
avg=sum/5;
Step 5: output sum, prod, avg
Step 6: stop
Practical #2: To find acceleration of a moving object with given mass
and the force applied.
Step 1: start
Step 2: Declare the variables mass, force, a
Step 3: Read the value of mass and force
Step 4: calculate acceleration
a= (force/mass);
Step 5: output a
Step 8: stop
Volume of Sphere:
Step 1: start
Step 2: Declare the variables r, volume
Step 3: Read the value of r
Step 4: calculate volume
Volume= (4/3.0) *3.14*r*r*r;
Step 5: output volume
Step 6: stop
Area of Triangle:
Step 1: start
Step 2: Declare the variables base, height, area
Step 3: Read the value base and height
Step 4: calculate area
area= (base * height) / 2;
Step 5: output area
Step 6: stop
Area of Parallelogram:
Step 1: start
Step 2: Declare the variables base, height, area
Step 3: Read the value base and height
Step 4: calculate area
area= height * base;
Step 5: output area
Step 6: stop
Area of Rhombus:
Step 1: start
Step 2: Declare the variables d1, d2, area
Step 3: Read the value d1 and d2
Step 4: calculate area
area = (d1 * d2) / 2;
Step 5: output area
Step 6: stop
Area of Trapezoid:
Step 1: start
Step 2: Declare the variables base1, base2, height, area
Step 3: Read the value base1, base2, height
Step 4: calculate area
area = ((base1+base2)/2) *height;
Step 5: output area
Step 6: stop
Practical #5: To convert Celsius to Fahrenheit temperature and vice
versa
Step 1: start
Step 2: Declare the variables Fahrenheit, Celsius
Step 3: Read the value of Fahrenheit
Step 4: calculate Celsius
Celsius = (Fahrenheit - 32) *5/9;
Step 5: output Celsius
Step 8: stop
To convert Fahrenheit into Centigrade
Step 1: start
Step 2: Declare the variables Fahrenheit, Celsius
Step 3: Read the value of Celsius
Step 4: calculate Fahrenheit
Fahrenheit = (Celsius *9/5) +32;
Step 5: output Celsius
Step 8: stop
Practical #6: Calculate the profit, loss, profit percentage and loss
percentage of a business.
Step 1: start
Step 2: Declare the variables cp, sp, profit, loss, profit_per, loss_per
Step 3: Read the value of cp and sp
Step 4: check for condition
If sp > cp then goto step 5 otherwise goto step 7
Step 5: profit=sp-cp
profit_per=(profit*100)/cp
Step 6: output profit, profit_per
goto step 11
Step 7: check for condition
If cp > sp then goto step 8 otherwise goto step 10
Step 8: loss=cp-sp
loss_per=(loss*100)/cp
Step 9: output loss, loss_per
goto step 11
Step 10: output No profit No Loss
Step 11: stop
Practical #7: To Calculate the grades of students on the basis of
marks. The score sheet should contain name of the student, father’s
name and class.
Step 1: start
Step 2: Declare the variable name, f_name, clas, marks
Step 3: Read the value of name, f_name, clas, marks
Step 4: check if condition
If marks<0 or marks>100 then output “wrong entry” goto step 12 otherwise
goto step 5
Step 5: check if condition
If marks<33 then output “Grade F” goto step 12 otherwise goto step 6
Step 6: check if condition
If marks>33 and marks<40 then output “Grade E” goto step 12 otherwise
goto step 7
Step 7: check if condition
If marks>40 and marks<50 then output “Grade D” goto step 12 otherwise
goto step 8
Step 8: check if condition
If marks>50 and marks<60 then output “Grade C” goto step otherwise
goto step 9
Step 9: check if condition
If marks>60 and marks<70 then output “Grade B” goto step 12 otherwise
goto step 10
Step 10: check if condition
If marks>70 and marks<80 then output “Grade A” goto step otherwise
goto step 11
Step 11: Output “Grade A1”
Step 12: stop
Practical #8: To Show whether a number is positive, negative or zero.
Step 1: start
Step 2: Declare the variables x
Step 3: Read the value of x
Step 4: check if condition
If x<0 then goto step 5 otherwise goto step 6
Step 5: output Number is Negative: goto step 9
Step 6: check if condition
If x>0 then goto step 7 otherwise goto step 8
Step 7: output Number is Positive: goto step 9
Step 8: output Number is 0
Step 9: stop
Practical #9a: To find the maximum number from input values
Step 1: start
Step 2: Declare the variables n, I, number, max=0
Step 3: Read the value of n
Step 4: check for condition
If i<=n then goto step 5 otherwise goto step 7
Step 5: read the value of number
Step 6: check the condition
If number>max then max=number goto step 5 otherwise goto step 6
Step 6: output max
Step 7: stop