Flowchart and algorithm

sayali_shiv 70,901 views 10 slides Sep 29, 2014
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

flowchart


Slide Content

F lowchart and algorithm

Write an algorithm for finding the average of two numbers and also draw a flowchart

Algorithm: Input: two numbers x and y Output: the average of x and y Step 1 : input x,y Step 2: sum=0,average=0 Step 3:sum = x + y Step 4:average = sum /2 Step 5: print average

START Input x Sum=average=0 Sum = x + y Average = sum/2 Print Average END

sums all the even numbers between 1 and 20 inclusive and then displays the sum

Step 1: start Step 2:sum = 0 ,count = 1 Step 3: if count /2==0 then goto step 4 Step 4:sum = sum + count step 5:count = count + 1 Step 6:if count <20 then go to step 3 step 7: DISPLAY sum Step 8: stop

To find the sum of first 50 natural numbers. Step 1: start Step 2:sum = 0 ,N= Step 3: N=N+1 Step 4:sum = sum + N step 5:i f SUM<50 then go to step 3 Step 6:DISPLAY sum Step 7: stop

Step 1:start Step 2:Input x, y Step 3:Sum = x + y Step 4:Average = sum/2 Step 5:Output Average Step 6:END