0% found this document useful (0 votes)
22 views

Lab 1 - Flowchart

The document contains examples of programming exercises. Exercise 4 checks if a number is the largest of three given numbers. Exercise 5 checks if a point is inside, outside or on a given circle. Exercise 6 checks the number of solutions to a quadratic equation. Exercise 7 calculates the average of given numbers. Exercise 8 classifies different types of triangles based on side lengths. Exercise 9 checks if the average of four given numbers is greater than or equal to 60.

Uploaded by

nemo
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)
22 views

Lab 1 - Flowchart

The document contains examples of programming exercises. Exercise 4 checks if a number is the largest of three given numbers. Exercise 5 checks if a point is inside, outside or on a given circle. Exercise 6 checks the number of solutions to a quadratic equation. Exercise 7 calculates the average of given numbers. Exercise 8 classifies different types of triangles based on side lengths. Exercise 9 checks if the average of four given numbers is greater than or equal to 60.

Uploaded by

nemo
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/ 7

Exercise 4:

Start

Read A,B,C

Print "B is the largest True False True True Print "A is the largest
B>C A>B A>C
number" number"

False False

Print "C is the largest


number"

Finish
Exercise 5:

Start

Read x, y, x0, y0, R

Calculate
d= sqrt((x-x0)2 + (y-y0)2)

Print 'A is outside the circle with center True


d> R
O(x0, y0) and radius of size R.

False

Print 'A is inside the circle with center True


d<R
O(x0, y0) and radius of size R.

False

Print 'A is on the circle with center


Finish
O(x0, y0) and radius of size R.
Exercise 6
Start

Print " the quadratic equation


Print x x = - c/b
is no solution

Read a, b, c
False

False

Print " the quadratic equation True True True


c=0 b=0 a=0
is infinity solution

False

Caculate
d = b2 - 4ac
Print x x = - b/2a

True

x1 = (- b + sqrt(d))/(2a) False False


d=0 d<0
x2 = (- b - sqrt(d))/(2a)

True

Print x1, x2
Print " the quadratic equation
have complex solution

Finish
Exercise 7

Start

Read N

i=1
S=0

True
Avg = S/N i>N

False

Print Avg Read Ai

S = S +Ai
Finish
i=i+1
Exercise 8

Start
max = C False
mid = B

max = B True Read A, B, C


B >= C min = A
mid = C

False

True
mid = B True True
B >= C max = A A >= B ( A - B )*( A - C ) >= 0
min = C

False

mid = C False
min = B

max = B True
B >= C mid = A
min = C

False
max = C
min = B

True
min + max <= mid Print not the triangle

True Print the isosceles


min2 + mid2 = max2 min = mid
right-angled triangle

False
Print the right-angled
triangle

True Print the equilateral


max = min
triangle

False
min = mid or True Print the isosceles
max = mid triangle

False

Print the normal


triangle

Finish
Exercise 9

Start

Read A, B, C, D

Calculate
X = (A + B + C + D)/4

True
Print pass X >= 60

False

Finish Print fail

You might also like