⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 阶乘.txt

📁 PL0语言的编译器
💻 TXT
字号:
\\程序完成的是 n! 的连加和,从 1 到 所输入的值
\\输入的值应该小于13,因为超过这个界限会导致数的越界

var   subresult , result , upperbound , i , flag;       
begin  
     read(flag);
     while  flag=0  do                                    \\是否进行运算
     begin
          read(upperbound);                            \\读入数据
          write(upperbound);                           \\反写出读入的数据
          i := 0;                                                
          result:=0;
          if   upperbound>=0 then                   \\判断读入的数据是否正确
                if    upperbound<=12 then         \\两个if 实现 && 的功能
                      while   i<=upperbound  do
                                begin
                                        if   i = 0  then
                                             subresult := 1;                                    

                                        if   i # 0  then
                                              subresult := subresult * i;
                                        result := result + subresult ;
                                        i := i+1
                                end;
          write(result);
          read(flag)                                         \\是否继续
     end;
end. 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -