Please Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • reepakmajhi.com@gmail.com

    Please Help

    Solve this Question
    Write a Program to find a number is even or odd?
  • Giff

    #2
    Re: Please Help

    reepakmajhi.com @gmail.com wrote:
    Solve this Question
    Write a Program to find a number is even or odd?
    LOL, no shame at all!
    Com'on, use your brain if you have one! How would you find out whether a
    number is even or odd?

    Comment

    • osmium

      #3
      Re: Please Help

      <reepakmajhi.co m@gmail.comwrot e:
      Solve this Question
      Write a Program to find a number is even or odd?
      The word you need is "modulo". Do something with it.


      Comment

      • blargg

        #4
        Re: Please Help

        reepakmajhi.com @gmail.com wrote:
        Solve this Question
        Write a Program to find a number is even or odd?
        Waste Google's time, not ours (it seems eager to help, BTW):


        Comment

        • red floyd

          #5
          Re: Please Help

          On Nov 13, 7:18 am, "reepakmajhi... .@gmail.com"
          <reepakmajhi... .@gmail.comwrot e:
          Solve this Question
          Write a Program to find a number is even or odd?
          Your answer can be found here: http://www.parashift.com/c++-faq-lit...t.html#faq-5.2

          Comment

          • ctrucza

            #6
            Re: Please Help

            On Nov 13, 5:18 pm, "reepakmajhi... .@gmail.com"
            <reepakmajhi... .@gmail.comwrot e:
            Solve this Question
            Write a Program to find a number is even or odd?
            how about this:

            bool is_even(int n)
            {
            return ( (n == 0) || (n == 2) || (n == 4) || ... || (n ==
            2*K) ); // for a carefully chosen value of K
            }

            Of course this will work correctly only for positive integers smaller
            or equal than 2*K.
            Extending it to work for negative numbers and other values of K is
            fairly trivial.

            Comment

            • Juha Nieminen

              #7
              Re: Please Help

              reepakmajhi.com @gmail.com wrote:
              Solve this Question
              Write a Program to find a number is even or odd?
              Why don't you ask your teacher? That's what they are for.

              Comment

              • Giff

                #8
                Re: Please Help

                ctrucza wrote:
                how about this:
                >
                bool is_even(int n)
                {
                return ( (n == 0) || (n == 2) || (n == 4) || ... || (n ==
                2*K) ); // for a carefully chosen value of K
                }
                LOL

                Comment

                • pandit

                  #9
                  Re: Please Help

                  On Nov 13, 8:18 pm, "reepakmajhi... .@gmail.com"
                  <reepakmajhi... .@gmail.comwrot e:
                  Solve this Question
                  Write a Program to find a number is even or odd?
                  Use Your Mind and put the Logic in the Programming(C++ ).

                  Comment

                  Working...