Day:37-While loop practice 3
Example1: package While; public class Police { public static void main(String[] args) { int police=0; int thief=40; while(police=3) { wrapper= wrapper-3; choco=choco+1; wrapper=wrapper+1; } System.out.println(choco); } } Output: 22

Example1:
package While;
public class Police {
public static void main(String[] args) {
int police=0;
int thief=40;
while(police
Output:
100
Example2:
package While;
public class Wrapper {
public static void main(String[] args) {
int choco=15;
int wrapper=15;
while(wrapper>=3) {
wrapper= wrapper-3;
choco=choco+1;
wrapper=wrapper+1;
}
System.out.println(choco);
}
}
Output:
22