1.

Suppose an array A[10] stores numeric values only. Write algorithms to(i) calculate the average of the values in A(ii) print the even numbers stored in A.

Answer»

(i) calculate the average of the values in A 

1. Start 

2. read A[i] 

3. let i=0,sum=0,avg=0

4. add A[i] into sum and store it into sum

5. divide sum by 10 and store it in avg

6. check whether i is less than 10 if yes than increment i by 1 

7. print avg 

8. End 

(ii) print the even numbers stored in A.

1. Start 

2. read A[i] 

3. let i=0 

4. check whether A[i]%2 is equal to 0 

5. if yes than print A[i] 

6. check whether i is less than 10 if yes than increment i by 1 

7. End



Discussion

No Comment Found