Sunday, 12 March 2023

10. Write a java program to display powers of 2 i.e. 2,4,8,16 etc up to 1024 using bitwise operators.



class Program10
{
    public static void main(String args[])
    {
        int a=1;
        for(int i=0; i<11; i++)
        {
            System.out.println(a << i);
        }
    }
}


No comments:

Post a Comment

python programs

1. sum of two number