2. Write an algorithm for
finding the average of two
numbers and also draw a
flowchart
3. 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
4. START
Input x
Sum=average
=0
Sum = x + y
Average = sum/2
Print
Average
END
5. sums all the even numbers
between 1 and 20 inclusive
and then displays the sum
6. 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
7.
8. To find the sum of first 50 natural numbers.
Step 1: start
Step 2:sum = 0 ,N= 0
Step 3: N=N+1
Step 4:sum = sum + N
step 5:if SUM<50 then go to step 3
Step 6:DISPLAY sum
Step 7: stop
9.
10. 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