DEV Community

yaswanth krishna
yaswanth krishna

Posted on

While Loop Basics

package hlo;

public class While {
    public static void main(String[]args) {
        int no=2;

          //0  //2 //5
---------->  while(no<=5) {
    "From 2 to 5, inclusive, anything less than or equal to."
            System.out.println(no);
            no=no+1; //2=2+1 =3
                                 // 3=3+1=4
                                 // 4=4+1=5
        }

    }

}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)