1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
liraira [26]
3 years ago
6

Code a program that will go through all the numbers from 1 to 100 and print them. However, if the number is evenly divisible by

3 then print the word "fizz" instead of the number. If the number is evenly divisible by 5 then print the word "buzz" instead of the number. And, if the number is evenly divisible by both 3 and 5, print the word "fizz buzz" instead of the number. Use a loop, and use modulus division. Only the driver class is needed, and in main just call 1 method called fizzBuzz().
In java.
Computers and Technology
1 answer:
worty [1.4K]3 years ago
8 0

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:

You might be interested in
The general case in a recursive function is the case for which the solution is obtained directly.
Reika [66]

Answer: False.

Explanation:

The general case of recursive function is when the solution is obtained recursively by simplification at each step.

However, it is the base case in a recursive function when the solution is obtained directly.

The general case must be reducible to base to arrive at a solution else the recursion would be a infinite recursion.

4 0
3 years ago
Why is the engineering design process important to the customer?
Ket [755]

The engineering design process important to the customer layout system permits things: A shared technique on a way to discover and remedy problems. A framework to assess ideas, tell priorities and save you myopic paintings.

<h3>What is the maximum vital step withinside the engineering layout system?</h3>

The first step withinside the engineering layout system is to outline the trouble that you are solving. This step is the maximum vital, as a defective know-how of the trouble handy ends in layout failures. Engineers paintings to discover the foundation trouble via way of means of opposite engineering the signs and symptoms they perceive.

The engineering layout system, via way of means of definition, is a sequence of steps that engineers use to discover an option to a trouble. These steps include: defining the trouble, brainstorming solutions, designing and constructing a prototype of the solution, trying out the solution, and enhancing it.

Read more bout the engineering :

brainly.com/question/17169621

#SPJ1

8 0
2 years ago
What is usually written in block style with the body text along the left margin.
Effectus [21]
A Business letter

6ix9ine
4 0
3 years ago
A variable of type unsigned short stores a value of 0. If the variable value is incremented, what exception will occur?A. No exc
yulyashka [42]

There are different kinds of variable. The answers are below;

  • If the variable value is incremented, therefore, No <u>exception </u>will occur.
  •  If the variable value is incremented, An <u>Overflow </u>will occur
  • If the variable value is decremented no exception will occur.

<h3>What is Underflow?</h3>

Underflow is a known to be a process or exception that happens if a number calculation is too small to be shown by the CPU or memory.

what causes a overflow is the Adding to a variable when its value is at the upper end of the datatype range.

Learn more about variables from

brainly.com/question/24751617

3 0
3 years ago
you're adding new wires in your building for some new offices. the building has a false ceiling that holds the lights and provid
AlladinOne [14]

Based on the above, the  type of cable that need to be used by you is option B) Plenum rated cable.

<h3>What is plenum rated cable mean?</h3>

Plenum rated cable is known to be a kind of a cable that tends to have a unique form of insulation that is known to have low smoke and low flame attribute.

Note that the Plenum cable is one that need to be installed in any "air handling" space and as such, Based on the above, the  type of cable that need to be used by you is option B) Plenum rated cable.

Learn more about cable from

brainly.com/question/13258934

#SPJ1

See full question below

You are adding new wires in your building for some new offices. The building has a false ceiling that holds the lights and provides an air path for heating and air conditioning. You would like to run your Ethernet cables in this area. Which type of cable must you use?

A) STP cables

B) Plenum rated cable

C) Cat 5e or Cat 6a cables

D) PVC jacketed cables

E) Fiber optic cables

6 0
1 year ago
Other questions:
  • FILL IN THE BLANK.
    15·1 answer
  • Which of the following are provided by most
    5·1 answer
  • Assume that messages sent between two programs can be lost, duplicated, delayed, or delivered out of order. Design a protocol th
    9·1 answer
  • Define some everyday if else statements you use to determine action. What are the branches of your statement?
    12·1 answer
  • This decision control structure enables the program to execute a statement or block of codes if and only if the Boolean expressi
    7·1 answer
  • Extend to also calculate and output the number of 1 gallon cans needed to paint the wal. Hint: Use a math function to round up t
    12·1 answer
  • Sorry but, what are brainliest for?
    7·2 answers
  • Write a function named minMax() that accepts three integers arguments from the keyboard and finds the smallest and largest integ
    5·1 answer
  • What are some examples and non-examples of digital security?
    6·1 answer
  • Your son is complaining that his smartphone is broken. He tells you that he cannot connect to the internet, nor can he make or r
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!