Write a java program that prints asks the user to enter a


Write a Java program that prints asks the user to enter a positive value (1 less than or equal to 200) and print each number up to that line, 1 per line with the following changes (SNAP CRACKLE POP).

• If a number is ***** by 2 (but not 3 or 5) print out SNAP instead of the integer.

• If a number is ***** by 3 (but not 2 or 5) print out CRACKLE instead of the integer.

• If a number is ***** by 5 (but not 2 or 3) print out POP instead of the integer.

• If a number is ***** by 2 and 3 (but not 5) print out SNAPCRACKLE instead of the integer.

• If a number is ***** by 2 and 5 (but not 3) print out SNAPPOP instead of the integer.

• If a number is ***** by 3 and 5 (but not 2) print out CRACKLEPOP instead of the integer.

• If a number is ***** by 2, 3, and 5 print out SNAPCRACKLEPOP instead of the integer.

Sample Runs:

Enter a positive value: 7

1

SNAP

CRACKLE

SNAP

POP

SNAPCRACKLE

7

Enter a positive value: 10

1

SNAP

CRACKLE

SNAP

POP

SNAPCRACKLE

7

SNAP

CRACKLE

SNAPPOP.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write a java program that prints asks the user to enter a
Reference No:- TGS01724296

Now Priced at $35 (50% Discount)

Recommended (94%)

Rated (4.6/5)