Answer to Question #290010 in Algorithms for Belous

Question #290010

An algorithm read numbers between 0and 15 and check whether number is even or odd then display sum of even numbers and average of odd numbers

1
Expert's answer
2022-01-23T12:48:44-0500


Start 
  Declare Integer number
  Declare Integer sum
  Declare Real average
  Declare Integer sumOdd
  Declare Integer counterOdd
  Set sum =0
  Set sumOdd=0
  for i =0 to 15 
     Dispay "Enter number [0-15]: "
     Read number
     if number mod 2 =0 
        sum= sum+number 
     else 
        sumOdd=sumOdd+number
        counterOdd=counterOdd+1
     end if
  End for
  average=sumOdd/counterOdd
  Display "Sum: ",sum
  Display "Average of odd numbers: ",average
Stop

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS