0% found this document useful (0 votes)
26 views15 pages

03 İNŞ246 IntroComProg

Uploaded by

karakayabarann
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)
26 views15 pages

03 İNŞ246 IntroComProg

Uploaded by

karakayabarann
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/ 15

İNŞ246

Com. Pro. in Civil Eng.


(#3 Flowchart)
Flowchart • Flowchart is an excellent way of communicating
the logic of a program.
• Easy and efficient to analyze problem using
flowchart.
• During program development cycle, the flowchart
plays the role of a blueprint, which makes program
development process easier.
• After successful development of a program, it
needs continuous timely maintenance during the
course of its operation. The flowchart makes
program or system maintenance easier.

• It is easy to convert the flowchart into any programming language code.


Flowchart Symbols
… is diagrammatic /Graphical representation of sequence of steps to solve a
problem. To draw a flowchart following standard symbols are use

Symbol Name Function

Process Indicates any type of internal operation inside the Processor or


Memory

Input / output Used for any Input / Output (I/O) operation. Indicates that the
computer is to obtain data or output results

Decision Used to ask a question that can be answered in a binary format


(Yes/No, True/False)

Connector Allows the flowchart to be drawn without intersecting lines or


without a reverse flow.

Predefined process Used to invoke a subroutine or an Interrupt program.

Terminal Indicates the starting or ending of the program, process, or


interrupt program

Flow Lines Shows direction of flow.

16/03/2023
Problem1
Find the area of a circle of radius r

Inputs to the algorithm : Radius r of the Circle.


Expected output : Area of the Circle

Flowchart Algorithm

start Step 1 : Start

Read r Step 2 : Read\input the Radius r

Area = 3.14 * r * r Step 3 : Area  Pi*r*r

Print Step 4 : Print Area


Area

end Step 5 : End

16/03/2023
Problem 2
Convert temperature Fahrenheit (F) to Celsius (C)
Inputs to the algorithm : Temperature in Fahrenheit, F
Expected output : Temperature in Celsius, C

Flowchart Algorithm:
start Step 1: Start

Read F Step 2: Read Temperature in Fahrenheit F

C= 5/9 * (F - 32) Step 3: C  5/9*(F-32)

Print C Step 4: Print Temperature in Celsius: C

end Step 5: End

16/03/2023
Problem 3
Flowchart for an algorithm which gets two numbers and prints
sum of their value
Inputs to the algorithm : First A and Second B.
Expected output : C of the two numbers

Flowchart Algorithm:
start Step 1: Start

Read A, B Step 2: Read the numbers A, B.

C= A + B Step 4: C  A + B

Step 5: Print Sum


Print C

Step 6: End
end

16/03/2023
Problem 4
Algorithm for find the greater number between two numbers.

Inputs to the algorithm : Two numbers A , B.


Expected output : C greater number

start Algorithm:

Step 1: Start
Read A, B
Step 2: Read/input A and B
true false
If A > B Step 3: If A greater than B then C=A
Step 4: If B greater than A then C=B
Print A Print B
Step 5: Print C

end
? Step 6: End

16/03/2023
Problem 4
Algorithm for find the greater number between two numbers.

Flowchart Algorithm:

Step 1: Start
start
Step 2: Read/input A and B
Read A, B

true false Step 3: If A greater than B


If A > B
Then print A
Print A Print B
Else print B

end Step 4: End

16/03/2023
Problem 4
Algorithm for find the greater number between two numbers.

Flowchart Algorithm:

start Step 1: Start

Read A, B Step 2: Read/input A and B

T Step 3: If A greater than B then C=A


C= A If A > B
F
T
C= B If B > A Step 4: If B greater than A then C=B
F
Print C Step 5: Print C

end Step 6: End

16/03/2023
Problem 5
Flowchart for an algorithm to calculate even numbers between 0 and 99

Inputs to the algorithm : numbers from 0 to 99,


Expected output : even numbers in given interval,

Flowchart Algorithm:

start Step 1: Start


I0 Step 2: I ← 0
I  I +2 Step 3: I ← I+2
Write I
Step 4: Write I in standard output
T
If I<98 Step 5: If (I <98) then go to line 3
F
end Step 6. End

16/03/2023
Problem 6
start
Flowchart for the
calculate the average Sum0, C0
from 25 exam scores
which supplied user’s
Enter Exam
Scores, S
entrance.
Sum=Sum + S

C=C+1
yes
If C<=25
no

Av = Sum / 25

Write Av

end
16/03/2023
Problem 7:
Develop an algorithm that prints on the screen whether an integer
number entered from the keyboard is odd or even, and draw the flow
chart.

Algorithm: start
1. Start
2. Read A Read A
3. B = floor(A/2)*2
4. If A=B then print ”Even” else print “Odd” B = floor(A/2)*2
5. End
true false
If A = B

Print “Even” Print “Odd”

end

16/03/2023
Example:
Flowchart for the problem of printing odd numbers less than a given
number. It should also calculate their sum and count.

Inputs to the algorithm : numbers from 0 to given number (n),


Expected output : odd numbers in given interval and their sum and count,

start n =10 n =100


I S W I S W
A
Read n 1 1 1 1 1 1
T 3 4 2 3 4 2
S0, W0, I1 If I<=n
5 9 3 5 9 3
F
7 16 4 7 16 4
Write I Write S
9 25 5 9 25 5
SS+I 11 36 6
Write W
… … …
WW+1
end 95 2304 48
II+2 97 2401 49
99 2500 50
A
16/03/2023
Example su
a
m
b
start c
Write an algorithm that gives the
product of two integer numbers Enter the
without using the multiplication numbers, a, b 5 3
operator and plot the flow diagram
a b
c0, sum0
5 x 3 0 0
c sum
sum = sum + b
3 0+3
5 c=c+1
3 + 3 + 3 + 3 + 3 1 0+1
yes
If c<=a
no 1 < 5
3 c a
Write sum
5 + 5 + 5
end

W
16/03/2023 4
Practice-2

You are supposed to prepare an algorithm and

a flowchart for the given problem.

Login canvas system

Submission due: 12.30

You might also like