Computer Science, asked by Ashjin, 6 months ago

Write the following program using while loop​

Attachments:

Answers

Answered by Oreki
3

Given Snippet:

public class Change1 {

   public static void main(String[ ] args) {

       int i, b = 0, c;

       System.out.println("The numbers are :");

       for (i = 1; i <= 10; i++) {

           c = b * b;

           System.out.println(c);

           b = b + 1;

       }

   }

}

After Converting:

public class Change1 {

   public static void main(String[ ] args) {

       int i = 1, b = 0, c;

       System.out.println("The numbers are :");

       while (i <= 10) {

           c = b * b;

           System.out.println(c);

           b = b + 1;  // b += 1 or b++

           i++;

       }

   }

}

Short explanation about the while loop:

https://brainly.in/question/33957417

Similar questions