显示错误(int i = n; i> 0; i--)

时间:2015-09-25 16:12:32

标签: java

我尝试按照代码

编写一个阶乘数程序的代码
public class Factorial {
    public static void main(String[] args) {
        Scanner in = new Scanner(System. in );


        System.out.println("Enter the number whose factorial you want: ");

        int n = in .nextInt();
        int f = 1;
        for (int i = n; i & gt; 0; i--) //error show what's wrong in for loop {
            f = f * i;
        }
        System.out.println("Factorial of " + n + " is " + f);
  }
}

1 个答案:

答案 0 :(得分:4)

是的,您的错误点是this.Then(/^I should see the login page$/, function () { browser.wait(EC.titleContains('Welcome'), 30000); return expect(browser.getTitle()).to.eventually.contain('Welcome'); }); ,它不是运营商的实际运营商& gt;。来自> XML编码>

使用此:

>

而不是

for (int i = n; i > 0; i--)
  

通常在您从某处复制过去的代码时会发生这种情况。

完整的代码应该是:

for (int i = n; i & gt; 0; i--)