Java Operators Excerise
Java Operators Excerise
TASK EXERCISE
Evaluate the following expressions
1. System.out.println(((13<<3)<100));
2. System.out.println(((13<<3)<100));
3. System.out.println(Math.pow((13>>2),3));
4. System.out.println((Math.pow((13>>2),3)<100));
6. Write Java program using the += operator and the while loop to generate the sum of 1 to 100
7. Write a program using the -= operator and the do while loop to generate the sum of 1 to 100
8. Write a program using /= operator and the do while loop and if selection structure to output the
number of times 2 is in 1024
9. Write a program using /= operator and the do while loop and if selection structure to output the
number of times is 200 divisible by 2
10. Write a program using %= operator and the do while loop and if selection structure to output all
the odd numbers and their sum between 0 and 100
11. Write a program using %= operator and the do while loop and if selection structure to output all
the odd numbers between -27 and 78
12. Implement the code below and write down its output. Explain what is happening
int x=1024;
for( int i=1;i<=10;i++)
System.out.println(x>>i);
13. Now Implement the code below and write down its output. Explain what is happening.
int x=1;
for( int i=1;i<=10;i++)
System.out.println(x<<i);
14. What lesson do you learn from number 12 and 13 above