Computer Science, asked by litti, 1 year ago

please yaar help kar do.....answer it plzzzz...

Attachments:

QGP: What is that line in if?
QGP: jTextFieldl ? or jTextField1?
QGP: Anyways Got it. It's jTextField1
litti: yess right

Answers

Answered by QGP
1
Hey There!!!

Let us first analyze the code. 


There is a while loop. The value of i starts from 1, and increments by 1 in each iteration. The loop breaks when i=5.

Using this info, we can write the code using for loop as follows:


for(int i=1;i<=5;i++)
{
    if(i * i == 4)
        jTextField1.setText(" "+i);

}





Hope it helps
Purva
Brainly Community

QGP: Let me edit it slightly
litti: thank you yaara
QGP: Done now.
litti: ok
Similar questions