Help with Computer Java Eclipse: Recall that you can tell if a number is divisib
ID: 3662433 • Letter: H
Question
Help with Computer Java Eclipse:
Recall that you can tell if a number is
divisible by another by using the modulus operator (%) which gives you the remainder from division. If the
result is zero (there is no remainder) then the first number is divisible by the second.
For your number game, we will count from 1 to 30 using the following rules:
1. If a number is divisible by 5, then print "beep" instead of the number
2. If a number is divisible by 8, then print "buzz" instead of the number
3. If a number is divisible by 12, then print "zap" instead of the number
Remember: if the number is divisible by both numbers, both words should print on the same line.
Explanation / Answer
public class Test { public static void main(String[] args) { String beep = "beep", buzz = "buzz", fizz = "zap"; //initialise the string variables for (int i = 1; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.