Algorithms & Flowchart: Assignment by Al Mamun Parvez, Depta Paul, Al Amin, Khairun Nahar Jinia
Algorithms & Flowchart: Assignment by Al Mamun Parvez, Depta Paul, Al Amin, Khairun Nahar Jinia
Algorithms & Flowchart: Assignment by Al Mamun Parvez, Depta Paul, Al Amin, Khairun Nahar Jinia
Assignment
By
Al Mamun Parvez , Depta Paul, Al Amin ,Khairun Nahar Jinia .
Algorithms
What is Algorithm ?
A sequential solution of any program that written in human
language,called algorithm.
Algorithm is first step of the solution process, after the
analysis of problem, programmer write the algorithm of that
problem.
Asetofrulesforsolvingaprobleminafinitenumberofstep
s,asforfindingthegreatestcommondivisor.
Alogicalarithmeticalorcomputationalprocedurethatifcorr
ectly applied ensuresthesolutionofaproblem.
Example of Algorithms:
Q. Write a algorithm to find out number is odd or even?
step 1 : start
step 2 : input number
step 3 : rem=number mod 2
step 4 : if rem=0 then
Else
endif
step 5 : stop
Flowchart
What is Flowchart ?
Graphical representation of any
program is called flowchart.
Pictorial representation of an
algorithm is called its flowchart.
The Flowchart
A Flowchart
Shows logic of an algorithm
Emphasizes individual steps and their
interconnections
e.g. control flow from one action to the
next.
Symbols of Flowchart
There are some standard graphics that are
used in flowchart as following:
Symbols of Flowchart
Symbols of Flowchart
A simple flowchart
Example of Flowchart:
Q. Make a flowchart to input temperature, if
temperature is less than 32 then print "below
freezing" otherwise print "above freezing"?
Example 1
step
step
step
step
4.
5.
6.
7.
Example 1
Flowchartfor calculate factorial value of
a number:
Example 1
c program to find out factorial value of a number
#include<stdio.h>
#include<conio.h>
intmain()
{
intn,i,fact=1;
printf("Enter any number : ");
scanf("%d",&n);
for(i=1; i<=n; i++)
fact = fact * i;
printf("Factorial value of %d = %d",n,fact);
return0;
}
Example 2
Q.Convert temperature Fahrenheit to Celsius.
Algorithm:
Step1: Start
Step 2: Read Temperature in Fahrenheit F
Step 3: C 5/9*(F32)
Step 4: Print Temperature in Celsius: C
Step5: End
Example 2
Flowchart:
Example 3
Write an algorithm that reads two values, determines the
largest value and prints the largest value with an identifying
message.
ALGORITHM
Step 1: Input VALUE1, VALUE2
Step 2: if (VALUE1 > VALUE2) then
MAX= VALUE1
else
MAX= VALUE2
endif
Step 3: Print The largest value is, MAX
Example 3
Flowchart
if else Statement
If (condition)
{
block1;
}
else
Entry
False
Block2
block2;
}
Condition
?
True
Block1
Entry
Loop Body
True
Test
Condition
False
Entry
Test
Condition
True
Loop Body
False
Thank You