0% found this document useful (0 votes)
38 views4 pages

Program # 01: Object

The document contains algorithms for 4 programs: 1) Performing mathematical operations on two numbers. 2) Converting between Cartesian and polar coordinates. 3) Calculating the area of a triangle given the lengths of its 3 sides. 4) Calculating the sum of the digits in a 5-digit number.

Uploaded by

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

Program # 01: Object

The document contains algorithms for 4 programs: 1) Performing mathematical operations on two numbers. 2) Converting between Cartesian and polar coordinates. 3) Calculating the area of a triangle given the lengths of its 3 sides. 4) Calculating the sum of the digits in a 5-digit number.

Uploaded by

ABDulNafe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

PROGRAM # 01

Object:
To perform Mathematical
operations(Addition,Subtraction,Multiplication,Division and Power)
on two numbers.

Algorithm:
Step1: Start
Step2: Declare variables a and b.
Step3: Read variables a and b.
Step4: Add a and b (a+b) and Display their addition.
Step5:Subtract a and b (a-b) and Display their subtraction.
Step6:Multiply a and b(a*b) and Display their Multiplication.
Step7:Divide a and b(a/b) and Display their Division.
Step8:Take Power of a and b and Display their answer.
Step9: Stop.

Program # 02
Object:
To Convert Cartesian Co-ordinate to Polar Co-ordinate & Polar Coordiante to Cartesian Co-ordiante.

Algorithm:
Step1: Start.
Step2: Declare vaariables x,y and ch.
Step3: Provide Two choices
a.)
b.)

Cartesian Coordinate to Polar Coordinate


Polar Coordinate to Cartesian Coordinate.

Step4: For Condition a,


-Read variables x and y.
-Declare variables r and theta.
-Calculate r ( r=(x2 + y2) ).
-Calculate theta (tan-1 y/x ).
-Display value of r and theta.
For Condition b.
-Declare variables r and theta.
-Read variables r and theta.
-Declare variables x and y.
-Calculate x (x=rcos(theta)).

-Calculate y (y=rsin(theta)).
-Display value of x and y.
Step5: Stop.

Program # 03
Object:
To Calculate Area of Triangle, given lengths of 3 sides.

Algorithm:
Step1: Start.
Step2: Declare variable a,b,c,p,area.
Step3: Read variables a,b and c(Lengths of triangle).
Step4: Calculate p (p=(a+b+c)/2).
Step5: Calculate area ( area = (p(p-a)(p-b)(p-c)) 1/2).
Step6: Display area of triangle.
Step7: Stop.

Program # 04
Object:
To Calculate Sum of 5-Digits.

Algorithm:
Step1: Start.
Step2: Declare variables int,num.
Step3: Read variable num(a 5-digits number).
Step4: Declare variables sum,temp,count.
Step5: Start a for loop to Calculate sum of given 5-digits.
Step6: Display the result(Sum of 5-digits).
Step7: Stop.

You might also like