DEV Community

yaswanth krishna
yaswanth krishna

Posted on

police thief while using "logical thinking"

package hlo;

public class While {
    public static void main(String[]args) {
        int police=0;
        int thief=40;
        while(police<40) {
            police=police+5;
            thief=thief+2;
        }
        System.out.println(police);

        }

    }





Enter fullscreen mode Exit fullscreen mode

output:
40

Top comments (0)