如何编写一个在伪代码中四舍五入小数点的算法

问题描述 投票:0回答:0

问题要求我添加另一种算法,将整数舍入到我的代码中。我该怎么做?

BEGIN
total <--- 0
count <--- 0
   REPEAT
     OUTPUT "Enter a number"
     INPUT nums
     Total<--- total + nums
     counter <--- counter + 1
     OUTPUT "Would you like to enter another number, enter yes or no" 
     INPUT ask
   UNTIL ask == no
average <--- total/count
OUTPUT ("average", average)
END

我当前的代码是

algorithm integer rounding pseudocode
© www.soinside.com 2019 - 2024. All rights reserved.