0% found this document useful (0 votes)
860 views

Java Exercises

This document contains 4 Java exercises. The 4th exercise prints the number 4 repeatedly, dividing it by 2 each time through a for loop with a condition of count being less than or equal to number, initially set to 4, and incrementing count by 1 each iteration. It demonstrates a for loop and modifying a variable within the loop.

Uploaded by

bing
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
860 views

Java Exercises

This document contains 4 Java exercises. The 4th exercise prints the number 4 repeatedly, dividing it by 2 each time through a for loop with a condition of count being less than or equal to number, initially set to 4, and incrementing count by 1 each iteration. It demonstrates a for loop and modifying a variable within the loop.

Uploaded by

bing
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Java Exercises

Exercise No. 1

Exercise No. 2

Exercise No. 3

Exercise No. 4
int number = 4; for (int count = 1; count <= number; count++) { System.out.println(number); number = number / 2; }

Assignment1

You might also like