Question
Write a program in java that prompts the user for a number n and prints out the numbers from 1 to n (inclusive), one per
Write a program in java that prompts the user for a number n and prints out the numbers from 1 to n (inclusive), one per line. If the number is evenly divisible by 3, print the word fizz after the number. If the number is evenly divisible by 5, print the word buzz after the number. If the number is evenly divisible by both 3 and 5, it will be followed by both fizz and buzz. Below is an example. Note: if the user enters a value for n that is less than 1, print the message
Error: n must be at least one.
What is the value of n? 16
1
2
3 fizz
4
5 buzz
6 fizz
7
8
9 fizz
10 buzz
11
12 fizz
13
14
15 fizz buzz
16
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started