http://www.technicalpage.net/search/label/SQL

>> " while " loop in Java / Selenium


" while " loop in Java / Selenium

int n = 0;

while(n<10) {
       System.out.println("The value of n is : "+n);
       n++ ;
}
Answer :
The value of n is : 0
The value of n is : 1
The value of n is : 2
The value of n is : 3
The value of n is : 4
The value of n is : 5
The value of n is : 6
The value of n is : 7
The value of n is : 8
The value of n is : 9


int n = 0;
      
while(n<10) {
       System.out.println("The value of n is : "+n);
       n = n+2 ;
}
Answer :
The value of n is : 0
The value of n is : 2
The value of n is : 4
The value of n is : 6
The value of n is : 8


int n = 10;

while(n>2) {
       System.out.println("The value of n is : "+n);
       n-- ;
}
Answer :
The value of n is : 10
The value of n is : 9
The value of n is : 8
The value of n is : 7
The value of n is : 6
The value of n is : 5
The value of n is : 4
The value of n is : 3



int n = 10;

while(n>2) {
       System.out.println("The value of n is : "+n);
       n=n-2;
}
Answer :
The value of n is : 10
The value of n is : 8
The value of n is : 6
The value of n is : 4

No comments:

Post a Comment