Why doesn't this code work? FizzBuzz JAVA

why doesn't t
why doesn't it work
why doesn't my
why doesn't he want me
why doesn't he love me
why doesn't youtube work
it doesn't matter carr
it doesn't matter nicholas carr summary

I cant get "FizzBuzz". No matter what the input, the "FizzBuzz" code isn't running. What did I do wrong?

public String[] fizzBuzz(int start, int end) {

int diff = end-start;
String[] array = new String[diff];

for (int i = 0; i < diff; i++) {
    if (start%3 == 0 && start%5 == 0) array[i] = "FizzBuzz";
    if (start%3 == 0 || start%5 == 0) {
        if (start%3 == 0) array[i] = "Fizz";
        if (start%5 == 0) array[i] = "Buzz";
    else {
        array[i] = String.valueOf(start);

    return array;

Logic in your if statements is a bit busted, using your code as the starting point, you'd have to do something like this.

if (start%3 == 0 && start%5 == 0) {
    array[i] = "FizzBuzz";
else if (start%3 == 0 || start%5 == 0) {
    if (start%3 == 0) array[i] = "Fizz";
    if (start%5 == 0) array[i] = "Buzz";
else {
    array[i] = String.valueOf(start);

Why doesn't the Leaning Tower of Pisa fall over?, If playback doesn't begin shortly, try restarting your device. Your browser does not currently Duration: 5:06 Posted: Dec 3, 2019 Why does he keep coming back if he doesn’t want a relationship? So if a guy doesn’t want you, why doesn’t he just let you go? Why does he keep reappearing (and always just when you start moving on)? Well … it’s not always so cut and dry. He may not want a relationship with you, but that doesn’t mean he has zero feelings for you.

String s = "" + i;
if ((i % 3) == 0) {
    s += " Fizz";
if ((i % 5) == 0) {
    s+= " Buzz";

This code snippet placed in a loop will print Fizz, Buzz and Fizz Buzz on i divisible by 3, 5 and 15 respectively.

Why doesn't medical school prioritize social justice?, Why doesn't medical school prioritize social justice? If academic medical institutions are serious about equity, work in the community should be� For the past 13.8 billion years, our Universe has been expanding, cooling, and gravitating. The hot Big Bang itself was, at least for our observable Universe, a one-time event that was the

you should try this.

    class FizzBuzz{
    public static void main(String args[]){
        int n = 100;
        for(int i=0;i<=n;i++){

            if((i % 3) == 0 && (i % 5) != 0){
            else if((i % 5) == 0 && (i % 3) != 0){
            }else if((i % 3) == 0 && (i % 5) == 0){


Night trains are brilliant. So why doesn't the UK have any to Europe , So why doesn't the UK have any to Europe? Britain is missing out on the boom in sleeper trains. But the biggest obstacle isn't logistics,� To find out why, Menachery has been giving mice at his Texas lab SARS — which is a very close cousin to the new coronavirus. Baby mice at his lab have shaken off the infection, while the older

IT Doesn't Matter, IT Doesn't Matter � Spend Less. Rigorously evaluate expected returns from IT investments. � Follow, Don't Lead. Delay IT investments to significantly cut costs and� Why doesn't God perform a spectacular miracle and prove himself? Q: "Why are there no clearly visible miracles today that shout -- without a shadow of a doubt -- to everyone in the world: 'There is a God!'?"

Why Doesn't This HR Department Get Any Respect?, And within a year, two of the five remaining senior managers had resigned as well. “It doesn't matter why those two left,” Robinson told Rose between bites of� Why doesn’t God respond when I cry out, “God, please help me!”? Question: "Why doesn’t God respond when I cry out, ‘God, please help me!’?" Answer: Many have felt abandoned by God in their times of greatest need, asking God for help but not receiving what was asked for.

If your computer doesn't recognize your iPhone, iPad, or iPod , If you connect your device to your computer with a USB cable and your computer doesn't recognize your iPhone, iPad, or iPod, get help. “Why doesn't my hydrangea bloom?" It wasn't until I became a Master Gardener that I ever thought about this question. I have always been familiar with the four main types of hydrangeas: the peegee (Hydrangea paniculata 'Grandiflora') tree that came with my parents' house in 1946; the 'Hills of Snow' variety (Hydrangea arborescens) between my parents' and the neighbor's backyard; my Uncle

  • Your second if should be an else if (because when both are true, either is also true).
  • Nice code, but I can't figure the detail why it doesn't fail. Can you edit the answer and add a description?
  • Sorry, my friend i didn't get your point. does you ask me to explain the code. OR In which term i should have to add description.