Write a program which allows the user to input a number at each iteration until a negative value is input . Calculate the average of all the input values between 40 and 80( inclusive ).( If you test your program with the following inputs :29,35,65,49,38,79,93,80,28,29,58,-7, the output should be 66.2.)
对基本原理的钻研,对基本技术的实践、改进和创新,对知识的延伸、迁移和再生产,正是工匠精神的内涵所在。运用不同的方法编写程序完成上述问题并浅谈心得体会。
- with a while loop ;
- with a for loop ;
- with logical vector ;
- with find function .