Video 21(ch5)

Yash
0

 



Program:-

https://drive.google.com/file/d/1iDA15BqHKHjyYB4dQygC474iWymWAl3J/view?usp=drivesdk


public class Main {

public static void main(String[] args) {

//The whole loop is executed when the given condition is true. Here the statement is executed unill the i become greater than 3 i.e 4.

System.out.println("printing of 1 to 3 using while loop:-");

int i = 1;

while(i<=3)

{

    System.out.println(i);

    i++;

    }

    //quick quiz 

    //wrie a program to print natural numbers form 100 to 200.

    System.out.println("printing of 100 to 200 using while loop:-");

    int a = 100;

    while(a<=200){

        System.out.println(a);

        a++;

        }

    // infinite loop

    /*while(true){

        System.out.println("This is an infinite loop");

        }*/

}

}

Post a Comment

0 Comments
Post a Comment (0)
To Top