Monday 24 July 2017

Print infinite numbers using WHILE loop

public class WhileExample {
public static void main(String[] args) {
    while(true){
   
    for(int i=0;;i++)
        System.out.println(i);
    }
}
}

OUTPUT:

1
2
3
4
5
6
7
8
9
and so on....

No comments:

Post a Comment