0
Need help and example so I can understand
1) Write a pseudocode algorithm to read a set of positive integers (terminated by 0) and print their average as well as the largest of the set.
4 odpowiedzi
+ 3
You don't need loops or the final 0 for this if you can use the max(), sum() and len() functions. e.g. using Python,
lst = [1, 3, 4, 2]
average = sum(lst) / len(lst) # 2.5
largest = max(lst) # 4
0
You can easily find on google
You need one array one variable for sum take one variable for iteration
array[n]
sum=0
For loop
sum=sum+array[i] this will give u sum find the average divide it by total number and use logic for greater number
0
i hate loops but thank you
0
Setsuko you can do many creativity with loops try pattern programs after that u will like to play with loops