Java - While Loop Labs
DIGIT COUNTER LAB
Lab Goal : This lab was designed to teach you how to use a while loop while reviewing the use of % and /.
Lab Description : Write a program that will take an integer number and count up how many digits the number contains. You must use a while loop and % to access each of the individual digits. Use / to reduce the number so that you can count all of the digits.
Sample Output :
234 contains 3 digits
10000 contains 5 digits
111 contains 3 digits
Lab Goal : This lab was designed to teach you how to use a while loop while reviewing the use of % and /.
Lab Description : Write a program that will take an integer number and count up how many digits the number contains. You must use a while loop and % to access each of the individual digits. Use / to reduce the number so that you can count all of the digits.
Sample Output :
234 contains 3 digits
10000 contains 5 digits
111 contains 3 digits
Answer To Lab DigitCounter Lab
Using the above lab as an example complete the following labs and turn them in.
2.while_loops_digitadder_lab_java_aplus.doc | |
File Size: | 33 kb |
File Type: | doc |
3.while_loops_digitavg_lab_java_aplus.doc | |
File Size: | 31 kb |
File Type: | doc |