跳至主要內容

JC1001 Practical / Lab 4 – Iterative statements

AI悦创原创Python 一对一教学Python 一对一教学大约 2 分钟...约 470 字

  1. Below you have the algorithm of a program that asks the user for a set of positive numbers and identifies the highest among them. The user enters the number 0 to finish the sequence. Implement the algorithm below and test it.
Set number with number entered by user
Set highest with number
while number is not 0
    if number is greater than highest
        Set highest with number
    Set number with number entered by user
print highest
ZH
  1. 下面是一个程序的算法,该程序要求用户输入一组正数并确定其中的最大值。用户输入数字0以结束序列。实现下面的算法并测试它。
设置 number 为用户输入的数字
设置 highest 为 number
当 number 不为 0 时
    如果 number 大于 highest
        设置 highest 为 number
    设置 number 为用户输入的数字
打印 highest
公众号:AI悦创【二维码】

AI悦创·编程一对一

AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发、Web、Linux」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然,还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线,随时响应!微信:Jiabcdefh

C++ 信息奥赛题解,长期更新!长期招收一对一中小学信息奥赛集训,莆田、厦门地区有机会线下上门,其他地区线上。微信:Jiabcdefh

方法一:QQopen in new window

方法二:微信:Jiabcdefh

上次编辑于:
贡献者: AndersonHJB
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度