Area of A Circle

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Area of a circle=The area of a circle is given by the formula A = π r2, where A is the area and r is

the radius. The circumference of a circle is C = 2 π r. If we "solve for r" in the


second equation, we have r = C / (2 π ).
3.141592654

The area of a circle is:

π (Pi) times the


Radius squared: A = π r2
or, when you know the
Diameter: A = (π/4) × D2
or, when you know the
0.5000000 Circumference: A = C2 / 4π

0.7853981634

Ex.

Radius = r = 3

Area= π r2
= π × 32
= 3.14159... × (3 × 3)
= 28.27 m2 (to 2 decimal places)

If you want to convert Celsius to Fahrenheit, just multiply the temperature by 1.8 and then add 32 to
the product. If you want to convert temperature from Fahrenheit to Celsius, subtract 32 from the
number and then divide the difference by 1.8.

greater than symbol is > less than symbol is < 50th FIBUNACCI NUMBER : 12586269025

Write your answers on a yellow pad paper. No erasures.

1. Create an algorithm and flow chart that finds the area of a circle.
2. Create an algorithm and flow chart that converts temperature from Fahrenheit to Celsius
3. Create an algorithm and flow chart which gets two numbers and prints the sum
4. Create an algorithm and flow chart thatfinds the greater number between two numbers
5. Create an algorithm and flow chart that that prints all even numbers between 9 and 100
6. Create an algorithm and flow chart that finds the largest number between 3 numbers.
7. Create an algorithm and flow chart that generates first 50 items of the Fibonacci series.
Algorithm and Flowcharts

CC 102 – Fundamentals of Programming

Algorithm and Flowcharts

A typical programming task can be divided into two phases:

Problem solving phase:

 Produce an ordered sequence of steps that describe solution of problem


 This sequence of steps is called an algorithm

Implementation phase:

 Implement the program in some programming language

Steps in Problem Solving

• First produce a general algorithm (one can use pseudo code)

• Refine the algorithm successively to get step by step detailed algorithm that is very close to a
computer language.

• Pseudo code is an artificial and informal language that helps programmers develop
algorithms. Pseudo code is very similar to everyday English.

Pseudocode and Algorithm

Example 1:Write an algorithm to Pseudo code: Detailed Algorithm:


determine a student’s final grade
and indicate whether it is passing 1.Input a set of 4 marks Step 1: Input M1,M2,M3,M4
or failing. The final grade is
calculated as the average of four 2.Calculate their average by summing and Step 2: GRADE = (M1+M2+M3+M4)/4
marks. dividing by 4
Step 3: if (GRADE < 50) then Print “FAIL” else
1. if average is below 50 Print Print “PASS” endif
“FAIL” else Print “PASS”

Flowchart

• (Dictionary) A schematic representation of a sequence of operations, as in a manufacturing


process or computer program.

• (Technical) A graphical representation of the sequence of operations in an information system


or program. Information system flowcharts show how data flows from source documents
through the computer to final distribution to users. Program flowcharts show the sequence of
instructions in a single program or subroutine. Different symbols are used to draw each type of
flowchart.
• Shows logic of an algorithm.

• emphasizes individual steps and their interconnections.

• e.g. control flow from one action to the next.

Flowchart Symbols

NAME SYMBOL USE IN FLOWCHART


OVAL Denotes the beginning or end of the
program.
PARALLELOGRAM Denotes an input operation.

RECTANGLE Denotes a process to be carried out e.g.


addition, etc.

DIAMOND Denote a decision to be made. The


program should continue along one of
the routes.
OVAL Denotes an output operation.

FLOWLINE Denotes an input operation.

Pseudo code and Algorithm

Detailed Algorithm:

Step 1: Input M1,M2,M3,M4

Step 2: GRADE (M1+M2+M3+M4)/4

Step 3: if (GRADE < 50) then Print “FAIL”


else Print “PASS” endif

Example 2:

Write an algorithm and draw a flowchart Algorithm


to convert the length in feet to
centimeter.
Step 1: Input Lft
Pseudo code:
Step 2: Lcm = Lft * 30
Input the length in feet (Lft)
Step 3: Print Lcm
Calculate the length in cm (Lcm) by
multiplying LFT with 30

Print length in cm (LCM)

You might also like