Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logic 我正在创建一个伪代码来确定用户输入的正数列表中的最大数_Logic - Fatal编程技术网

Logic 我正在创建一个伪代码来确定用户输入的正数列表中的最大数

Logic 我正在创建一个伪代码来确定用户输入的正数列表中的最大数,logic,Logic,我正在创建一个伪代码来确定用户输入的正数列表中的最大数。用户还应通过输入0指示他/她已完成数字输入。谢谢你max你的问题是什么? max <-- 0 // assigning max to 0 n <-- read() // read user input while n!=0 { if(n>max) // check if n is greater than max max <-- n // if true update

我正在创建一个伪代码来确定用户输入的正数列表中的最大数。用户还应通过输入0指示他/她已完成数字输入。谢谢你

max你的问题是什么?
max <-- 0     // assigning max to 0      
n <-- read()  // read user input

while n!=0 
{
  if(n>max)     // check if n is greater than max
     max <-- n  // if true update max

  n <-- read()  // read next input
}

print(max)     // print max