forum

Home / DeveloperSection / Forums / Infinite loop in java

Infinite loop in java

Norman Reedus 2151 13-Nov-2014

I am trying to solve a problem using java where I have to print the number the same number of time as the number itself. For example 1 will be printed once 2 twice 3 thrice and so on. I tried to attempt the question using nested loop but it is going into infinite loop. Please pinpoint the mistake in the code. Thanks!

 {                                         
    for (int i=1;i<=10;i=i+1) {
        for (int j=1;j<=i; j=i) {
            jTextArea1.append(""+j);
        }
    }
 }         

P.S I attempted this question using netbeans.


Updated on 13-Nov-2014

Can you answer this question?


Answer

1 Answers

Liked By