- /** Information for answering
question number 13
- * Practice Test
Chap 5 & 6, Data Types, Variables, and Arithmetic
- * @author T.
K. Rogers @version 11-24-05 */
- public class
ModulusTestAnsw_17 {
-
public static void main ( ) {
-
int output;
-
-
System.out.println ( "Outputs 1 if evenly divisible and
0 if not." ) ;
-
-
// Note the loop below merely creates numerous examples
to
-
// indicate that the code actually works.
- for (
int y = 0 ; y <= 40 ; y++ ) {
-
output = 1 - ( y % 17 + 16) / 17 ;
-
System.out.println ( "y = " + y + "\t output = " +
output ) ;
- }
- }
- }