Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

LOOPS PLEASEE HELP ME

mocchimocchi Posts: 2Member

Write a method called wowzaCowza that prints the numbers from 1 to 100, one per line.

For multiples of three print

Comments

  • JonathanJonathan Posts: 2,914Member
    Hi,

    Look up the % (modulo) operator - if something % 3 == 0 then you know dividing three into it has no remainder and thus it is a multiple of three, for example.

    Jonathan
    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
  • mocchimocchi Posts: 2Member
    : Hi,
    :
    : Look up the % (modulo) operator - if something % 3 == 0 then you
    : know dividing three into it has no remainder and thus it is a
    : multiple of three, for example.
    :
    : Jonathan
    : ###
    : for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    : (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    : /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");


    Thanks a lot!!! i appreciate it

    is it ok if i ask you another question..???


    ********************************************************************
    Consider the following infinite sequence of numbers:

    0, 1, 1, 2, 4, 7, 13, 24, 44,
  • sizksizk Posts: 2Member
    public static void main(String args[])
    {
    int a = 1;
    String W ="Wowza";
    String C ="Cowza";

    while (a <=100)
    {
    if ( a%3==0 && a%5==0)
    {
    System.out.println(W + C);
    }
    if (a%3==0)
    {System.out.println (W);
    }
    else if (a%5==0)
    {System.out.println(C);
    }
    else
    {
    System.out.println (a);
    }

    a++;


    }


    }
  • sizksizk Posts: 2Member
    public static void main(String args[])
    {
    int a = 1;
    String W ="Wowza";
    String C ="Cowza";

    while (a <=100)
    {
    if ( a%3==0 && a%5==0)
    {
    System.out.println(W + C);
    }
    if (a%3==0)
    {System.out.println (W);
    }
    else if (a%5==0)
    {System.out.println(C);
    }
    else
    {
    System.out.println (a);
    }

    a++;


    }


    }
Sign In or Register to comment.