Day 37: Looping Practice& find divisors of count

package demo_programs; public class Looping3 { public static void main(String[] args) { // TODO Auto-generated method stub int total=8; int count=3; int eaten=0; while (count 1) { securityCount += 1; box = box / 2; } System.out.println(securityCount); } } Find divisors count of given Numbers package demo_programs; public class Looping5 { public static void main(String[] args) { // TODO Auto-generated method stub int no=20; int div=1; int count_of_divisors = 0; while (div

May 5, 2025 - 05:29
 0
Day 37: Looping Practice& find divisors of count
package demo_programs;

public class Looping3 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int total=8;
        int count=3;
       int eaten=0;

        while (count<=3){
          eaten = total/2;
            total+=eaten;
            count+=1;
        }System.out.println(total);
    }

}

package demo_programs;

public class Looping4 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
                int box = 1024;
                int securityCount = 0;
                while (box > 1) {
                    securityCount += 1;
                    box = box / 2;
                }
                System.out.println(securityCount);

    }

}

Find divisors count of given Numbers

package demo_programs;

public class Looping5 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
       int no=20;
       int div=1;
       int count_of_divisors = 0;
       while (div<=no) {
           if (no%div == 0) 
           System.out.println(div);
               //count_of_divisors = count_of_divisors + 1
               count_of_divisors+=1;
          div+=1 ;      }}}