Westonci.ca is the Q&A platform that connects you with experts who provide accurate and detailed answers. Connect with a community of experts ready to help you find accurate solutions to your questions quickly and efficiently. Join our platform to connect with experts ready to provide precise answers to your questions in different areas.
Sagot :
Answer:
public class Main
{
// required method
public static void fizzBuzz(){
// looping through 1 to 100
for(int i = 1; i <= 100; i++){
//if number is evenly divisible by both 3 and 5
if(i%3 == 0 && i%5 == 0){
System.out.println("fiz buzz");
}
// if number is divisible by 3
else if (i%3 == 0){
System.out.println("fizz");
}
// if number is divisible by 5
else if (i%5 == 0){
System.out.println("buzz");
}
// if number is not divisible by both 3 and 5
else {
System.out.println(i);
}
}
}
// main method
public static void main(String[] args) {
//calling function
fizzBuzz();
}
}
Explanation:
We appreciate your visit. Hopefully, the answers you found were beneficial. Don't hesitate to come back for more information. Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. We're here to help at Westonci.ca. Keep visiting for the best answers to your questions.