Flowcharts for Programming - Lecture 1 | Prof. Kamal Ghanshala | Graphic Era University
Summary
TLDRThis video script offers a comprehensive introduction to flowcharts, emphasizing their utility in programming for maintaining the sequence of instructions. It explains the significance of sequencing in programs and how flowcharts assist in this process. The script outlines the basic symbols used in flowcharts, such as start/stop, input/output, assignment, decision, and connectors. It illustrates these concepts with examples, including generating bills for mango sales with varying levels of input requirements, and calculating the average of three numbers. The script also highlights the importance of proper syntax in flowchart assignments to ensure accurate program translation.
Takeaways
- 📝 A flowchart is a diagrammatic representation of a process, useful for maintaining the proper sequence of instructions in programming.
- 🔢 A program is a set of instructions in a specific sequence, and flowcharts help in visualizing this sequence before writing the actual program.
- 🏁 Flowcharts start with a 'start' symbol, which is a box rounded at both ends, and end with a similar 'stop' symbol.
- 📥 The 'input' or 'read' statement in a flowchart represents the values supplied by the user, which are stored in variables like n1, n2, and n3.
- 📤 The 'print' or 'output' symbol, shown as a parallelogram, is used to display results from the program.
- 🔄 The 'assignment box', a rectangular symbol, is used for calculations, such as assigning the result of a formula to a variable.
- ❓ The 'decision box', in a diamond shape, represents a yes/no decision in the flowchart, such as checking if one value is greater than another.
- 🔗 Connectors are used when continuing a flowchart in a different part of the diagram, represented by a circle with a label inside.
- 🍋 Examples in the video include generating a bill for mango purchases, where known values or user inputs are used to calculate the total cost.
- 🔢 Another example includes calculating the average of three numbers inputted by the user, with emphasis on correct syntax when writing equations in programming.
Q & A
What is a flowchart?
-A flowchart is a diagrammatic representation of a process, used in programming to maintain the proper sequence of instructions.
Why is sequencing important in a program?
-Sequencing is important in a program because it ensures that the set of instructions are executed in the correct order.
What is the first step in drawing a flowchart?
-The first step in drawing a flowchart is to write 'start' and then draw a rounded box from both ends to represent the beginning of the process.
How is input represented in a flowchart?
-Input in a flowchart is represented by writing 'input' or 'read' followed by a list of arguments, such as 'n1, n2, n3', which signifies that the user will supply three values.
What symbol is used to represent output in a flowchart?
-Output in a flowchart is represented by a parallelogram, with 'print' followed by the list of arguments whose values are to be displayed.
What is an assignment box in a flowchart?
-An assignment box in a flowchart is a rectangular box used to represent calculations or assignments, such as 'result is equal to a into b plus c'.
How are decisions represented in a flowchart?
-Decisions in a flowchart are represented by a diamond-shaped box, which indicates a yes/no type of decision, such as 'a greater than b'.
What is the purpose of a connector in a flowchart?
-A connector in a flowchart is a circle with a label (like 'x') used to indicate where the flowchart resumes after a jump or loop.
How does a flowchart help in generating a bill for Bogilal's mangoes?
-A flowchart helps in generating a bill for Bogilal's mangoes by diagrammatically outlining the steps to calculate the total cost based on the rate per mango and the number of mangoes bought.
What is the significance of a 'stop' symbol in a flowchart?
-The 'stop' symbol in a flowchart signifies the end of the process or program, indicating where the flowchart concludes.
How can a flowchart be used to find the average of three numbers?
-A flowchart can be used to find the average of three numbers by diagramming the steps to input the numbers, calculate their sum, divide by three, and then print the average.
Outlines
📊 Introduction to Flowcharts
This paragraph introduces the concept of flowcharts in programming. A flowchart is defined as a diagrammatic representation of a process, crucial for maintaining the sequence of instructions in a program. The paragraph explains that a program is a set of instructions in a proper sequence, and flowcharts are used to visualize and maintain this sequence before writing the actual code. The paragraph also describes the basic elements of a flowchart, such as the start and stop symbols, input and output symbols, assignment boxes, decision boxes, and connectors. The speaker uses examples to illustrate how these elements are used in flowcharts to represent different programming constructs.
🛒 Flowchart for Generating a Bill
This paragraph delves into the application of flowcharts by demonstrating how to create a flowchart for generating a bill for mangoes sold by Bogilal. The speaker presents three scenarios with increasing complexity: a fixed sale of five mangoes at a fixed rate, a sale where the number of mangoes is variable but the rate is fixed, and a scenario where both the rate and the number of mangoes are variable and need to be input by the user. Each scenario is explained with a corresponding flowchart, highlighting the use of input, calculation, and output steps. The paragraph emphasizes the flexibility of flowcharts in adapting to different program requirements.
🔢 Flowchart for Calculating Average
The paragraph focuses on creating a flowchart to calculate the average of three numbers. It discusses the need for user input to supply the three numbers and then describes the steps involved in calculating the average. The speaker explains the use of input boxes to gather the numbers, an assignment box to calculate the sum, and another assignment box to compute the average by dividing the sum by three. The paragraph also includes a discussion on the correct way to format calculations in flowcharts to ensure they are represented accurately and can be translated into valid computer statements.
🔄 Flowchart Simplification and Common Mistakes
In this paragraph, the speaker discusses the possibility of simplifying the flowchart for calculating the average of three numbers by combining steps into a single line. They also address common mistakes made by students when writing calculations in flowcharts, such as not properly enclosing the entire expression in parentheses, which can lead to incorrect calculations. The speaker emphasizes the importance of continuity and proper formatting in flowcharts to ensure they accurately represent the intended program logic.
Mindmap
Keywords
💡Flowchart
💡Start/Stop
💡Input
💡Output
💡Decision Box
💡Assignment Box
💡Connector
💡Input/Output Box (Parallelogram)
💡Program
💡Calculation
Highlights
Flowcharts help in maintaining the proper sequence of instructions in a program.
A program is a set of instructions in a proper sequence, and flowcharts help in planning the sequence.
Flowcharts start with a 'Start' box and end with a 'Stop' box, both rounded at the ends.
User input in a flowchart is indicated with an input or read statement, followed by a list of arguments.
The 'Print' command in a flowchart is used to display output values to the user.
Calculations are represented by assignment boxes in rectangular shapes.
Logical decisions are made using decision boxes that allow 'Yes' or 'No' type decisions.
Connectors in flowcharts, marked with circles, help resume the process from a specific point.
Problem example: Bogilal sells mangoes at a fixed price of 10 per mango. The flowchart directly calculates and prints the bill for a known number of mangoes.
In a more flexible flowchart, the user inputs the number of mangoes, and the bill is calculated based on user input.
For variable rates, the user inputs both the number of mangoes and the rate per mango, and the bill is calculated accordingly.
Problem: Find the average of three numbers. The flowchart includes user input for three values, calculation of the sum, and division by 3 to get the average.
The flowchart can be simplified by combining the calculation and input steps into a single line.
Important note: Incorrect formula formatting, such as breaking the average calculation into multiple lines, results in invalid computer code.
The correct approach is to write the entire expression, such as the average calculation, in one continuous line.
Transcripts
today we are discussing flowcharts
so what is a flowchart first of all let
us define a flowchart a flowchart is a
diagrammatic representation of a process
okay
in programming it helps us in
maintaining the proper
sequence of instructions so first of all
let us see what is a program
a program is a set of instructions
in a proper sequence ok so sequencing is
very important in program and for
maintaining the sequence
before writing the program what we do we
draw a flowchart flowchart helps us in
maintaining
the sequence of a program ok
whenever we start drawing a flowchart we
write start
and then we close start
ok to this type of box which is rounded
from both the
ends see whenever we
complete our flowchart we write stop
again we draw same type of box which is
rounded from
ok here and here
see whenever user supplies some values
to the program which is called input
inputting the values okay
so what we do we write input or we write
read
and then we write list of arguments
suppose i am writing
n one comma n two comma n3
it means whenever this program will get
executed at that time user will supply
you three values
okay first value will replace n1 second
value will replace
n2 and third value will replace n3 okay
similarly whenever we want to
display something to outside world
whenever the programmer wants to display
something
some result to outside world then what
he will be doing he'll be writing
and again list of arguments whose values
you want to
display ok suppose arguments are
a one comma a two comma a three so i
will be writing a one
comma a two comma a three
so whenever this program will get
executed
the values of a one a two and a three
will be printed or will be displayed
ok similarly when we have to do some
calculation
then we draw assignment box ok
which is our rectangular box so this is
this type of rectangular box is called
assignment box
suppose i am writing
result is equal to a
into b plus
c so what will happen first of all
this a into b plus c will be calculated
so this will be calculated and this will
be assigned to
result okay so this is called assignment
box where right hand side gets
calculated and gets assigned to
left hand side okay
now suppose we have to take a decision
suppose
we are moving in this direction and now
we have to take a decision
ok logical decision then will be drawing
a decision box like this
ok suppose this is a logical decision it
means ah yes no type of decision
h a greater than b
ok if it is yes
then i am moving in this direction and
if it is
no then i am moving in
this direction because either a will be
greater than b or it will be smaller
than or equal to
b so this is called a decision box
at times you require some connectors
also
ok suppose
now i do not have space here so now what
will i be doing i will be drawing a
connector here suppose i draw a
connector it is a
circle i draw a connector here and i
write
x here it means
now i will be starting from i will be
resuming from
x so now if i write x
and like this it means whatever i have
left here now i am
resuming from here so this is called a
connector
ok so so far we are discussing only
these many symbols because so far we
wont be drawing loops whenever
we draw loops then will be draw we will
be discussing
some more symbols ok so now let us start
drawing some basic flowcharts see our
first
problem is like this problem number one
bogilal sells mangoes at rupees 10
per mango mohan bought five mangoes from
bogie lal
now we have to draw a flow chart to
generate bill
okay now here we know what is the rate
rate is rupees 10 per mangoes how many
mangoes
one bought five mangoes ok so
we will be drawing flow chart like this
now we need not to input anything
because we already know everything we
know the rate we know the number of
mangoes so
we need not to input anything we will be
drawing a flowchart like this
start
we can directly calculate bill we may
write
well is equal to rate is 10
into number of mangoes is 5
and after that once we know the bill
then will be printing the value of
bill so will be drawing a parallelogram
and will be writing
print bill
ok and after that i am writing
stop
so whenever a programmer will make a
program according to this flowchart
ok that program will not input anything
whenever that program will get executed
it will
be directly generating the value of bill
and which will always be
rupees 50 okay so
normally our flow charts are not as
simple as this one
so let us take one more example
next one now let us discuss
bit more generalized type of problem
problem number two bogilal sells mangoes
at rupees 10 per mango
okay so rate is fixed draw flow chart to
generate
bill now if we have to generate well we
must know how many mangoes a customer
is buying so that is not given it means
that will be
inputted in our program ok that will be
asked from the user whenever this
program will get executed
that value will be supplied by the user
ok so now we have a flexibility earlier
we were selling only five mangoes now
we may change number of mangoes because
the user will decide how many mangoes he
has to
buy so now we'll be drawing our flow
chart like this will write start
now we are now deciding number of
mangoes number of mangoes
will be supplied by the user so we'll be
writing
input input means user will supply
input number of
mangoes okay here we may write n m means
number of
mangoes so input number of mangoes
and m and
after that we are writing once we know
number of mangoes because rate is fixed
so what will be our bill our
bill will be equal to 10
that is the rate and into number of
mangoes
what do we do after this
after this since we have calculated well
so we have to display to the outside
word so will be using a
print statement so
what will have will be enclosing it in a
parallelogram and then we will write
i'll write print bill so whenever this
program will get executed ok because we
are drawing flowchart then based on this
flowchart
what will happen programmer will write
program
and whenever this program will get
executed
at that time what will happen ok
whenever
programmer writes a program according to
this flowchart and that program gets
executed so
at the execution time first of all
here the program will ask input number
of mangoes so the user will have to
supply
number of mangoes okay then the program
will calculate
and then the program will display
ok print or display bill ok whatever
bill we have calculated that will be
displayed to
outside work ok that is how this
flowchart will work
now let us take our problem number 3
which is
more generalized ah here bogilal is
selling mangoes
ok because rate may change every day so
rate is not given
draw flow chart to generate bill so here
rate is not given and number of mangoes
because number of mangoes will also
change from customer to customer so that
is also not
given so from where will we get rate and
number of mangoes
so both have to be inputted ok
have to be whenever we have to generate
build so both these values have to be
inputted have to be supplied
by the user okay so
our flowchart will be like this start
now i have to input input
first of all number of mangoes
and rate
okay
we may specify what is nm nm is
number of mangoes
once we know number of mangoes and rate
then we can very well find bill
what will be our bill
bill is equal to number of mangoes
into rate ok basically its rate per
mango
so once we know number of mangoes and
rate of mango
red per mango then we can always
calculate bill is equal to number of
mangoes
into our rate
ok and after that what we do once we
know the
bill then what we can do we can display
parent bill
and after that we stop
ok so now what happens
whenever somebody writes a program
according to this flowchart
this is small r whenever somebody writes
a program according to this flowchart
then and see once a program is returned
so first of all it is compiled it means
it is changed
it is translated to machine language ok
and after that its
loaded and after that you may execute it
so whenever this program will get
executed so
first of all
at this point see
user need to supply two values ok the
program will ask user to supply
two values at this point number of
mangoes
and rate per mango okay based on
these two values the bill will be
calculated
and once bill will is calculated the
value of bill will be
printed here okay so now if some user is
executing this program so he need to
supply two values first is number of
mangoes second is rate
and soon after supplying these two
values will
get a value which will be the value of
bill okay so this is our problem number
one problem number three now we are just
okay for for some time we are shifting
from bogilal
okay we are taking one more very simple
flowchart draw flowchart to find
average of three numbers ok
so now this has to be a generalized
program which should be able to find
average of any three numbers okay
now the question arises who will be
supplying those numbers
the user will supply three numbers okay
for which he wants to find average so
since the user has to supply three
numbers so our flow chart will be like
this will write
start
and after this because numbers have to
be supplied by the user so i will have
to input those numbers
input means numbers will be supplied by
the
user input suppose
ok i am just taking three variables n
one n two
and n three ok so
input n one comma n two comma n three so
i have taken three variables here
n one n two and n three ok
see whenever this program will get
executed at that time
three values will be supplied and first
value will be replacing
n1 second will be for n2 and third will
be for
n3 okay so once we have n1
n2 and n3 because in our program we are
assuming that our three numbers are n1
n2 and n3 at the same time we are
inputting inputting means whenever this
program will get
executed user will supply three values
for these three
n one n two and n three now
ah once we know and one in our program
we have assumed that numbers are n one
and two and
n three so what will be the sum
sum will be n one comma
sorry n one plus n two plus
n three this is quite simple
some will be n one plus n two plus n
three and what will be average
ok i am taking a variable avg for
average average
will be equal to sum divided by
3 and once we know the average
this will also be a rectangular box
because i am doing calculation once we
know the average then what will we do
we will print average because we were
supposed to
calculate average so now what are we
doing we are displaying it
print a v g so whatever is the value of
average that will be printed and then we
stop
ok now again same thing whenever this
program will get
executed at that time first of all
the user has to supply three values
user has to supply three values n1 n2
and n3 okay based on those three values
some will be calculated and after that
average will be calculated and then
average will be printed ok now i can
draw a smaller flowchart also
because these two things i can do in a
single line also
so like let me draw a smaller one start
ah input
n one comma n two comma
n three
i can directly calculate average a
v g is equal to n one plus
n 2 plus n 3
this whole divided by
3
ok since i am calculating so this will
be our rectangular box and after that i
am writing
print average
okay print average and then
i just a minute
and after that i stop
ok now what i have done i have done
these two things in a single line here
ok but
i should not write like this i should
not write ah
some of the students they write like
this they write
ah average is equal to
n 1 plus n 2 plus n 3
divided by 3 if they do like this then
only
n 3 will get divided by 3 okay some of
the students are doing it like this also
they write
average is equal to n 1 plus n 2
plus n 3 divided by 3
see this is not a computer statement
because in computer
see whatever language in whatever
language you are doing programming
you have to write in a single line so
here
first line second line third line so
this is not a valid computer statement
ok
so your entire expression should be in
continuity
so what is the right way of doing it i
have to write like this
average is equal to n 1 plus n 2
plus n 3 this whole
divided by 3 okay so these 2 are
wrong ok fine
تصفح المزيد من مقاطع الفيديو ذات الصلة
Memahami Algoritma dan Pemrograman
FLOWCHART - PART 2 | DECISION SYMBOL
#3 Notasi Algoritma (Kalimat Deskriptif, Flowchart, dan Pseudocode)
41. OCR A Level (H046-H446) SLR8 - 1.2 Introduction to programming part 2 variables & constants
Algoritma dan Pemograman | Informatika X
TUGASS PRESENTASI PEMOGRAMAN 1 KELOMPOK 7
5.0 / 5 (0 votes)