- Write a program Bits.java that takes a command-line argument N and uses a while loop to compute the number of times you need to divide N by 2 until it is strictly less than 1. Print out an error message if the integer N is negative.
% java Bits 0 % java Bits 8
- 4
% java Bits 1 % java Bits 16
- 5
% java Bits 2 % java Bits 1000
- 10
% java Bits 4 % java Bits -23
- Illegal input
- Design and implement an application named java that reads a string and two index values from the user, then swaps the characters with the specified index values, and save the resulting string in a variable. The program should have an input verification loop ensuring that the specified index values are within range, and a loop that asks users if they want to run the program again.
Reviews
There are no reviews yet.