Function detect odd and even number

Do you know a function which can detect if a number is an odd number or other.

if ( number%2 == 1)
But a method for this? Really doubt that..
Do you know a function which can detect if a number is
an odd number or other.

Similar Messages

  • Create function for ODD or EVEN(NUMBER)  in pls sql

    create function for ODD or EVEN(NUMBER) also
    if number is odd multiply by 5
    if number is even multiply by 10;

    865253 wrote:
    create function for ODD or EVEN(NUMBER) also
    if number is odd multiply by 5
    if number is even multiply by 10;
    create function fn_get_no (n_in in number) return number is
    o_num number;
    begin
    if mod(n_in,2) = 0 then
    o_num := n_in*10;
    else
    o_num := n_in*5;
    end if;
    return o_num;
    end;
    select fn_get_no(5) odd, fn_get_no(4) even from dual;
    ODD EVEN
    25 40 Vivek L

  • Detecting odd and even numbers

    How can I now when an integer is an even or an odd number?

    How can I now when an integer is an even or an odd number?Either of these will work:
    if (i % 2 == 0)
        // even
    else
        // odd
    if ((i & 1) == 0)
        // even
    else
        // odd

  • Odd and Even Headers in Pages 5

    I think this has been asked before, but is it possible to making different odd and even-paged headers in Pages 5? I can't figure it out.

    You can take this to be the answer for most things Pages 5…
    … No!
    Use Pages '09 instead.
    Peter

  • Different margin for odd and even pages

    Hi there,
    I am writing a book which will be printed in 2 sided paper. Therefor I will need different margin (left and right) for the odd and even pages.
    How is it possible in Pages? I am using Pages 5.2 (1860).
    Thank you.
    Sebastian.

    Indesign & Xpress are professional DTP applications. They can layout pages in any order you can imagine with custom margins. They are also complex to learn & expensive in comparison to Pages.
    There is a trial of Indesign IIRC…
    https://www.adobe.com/uk/products/indesign.html
    Quark also has a trial too…
    http://www.quark.com
    I expect there may be cheaper 'layout' software that is capable of arranging facing pages correctly (possibly from a single pages PDF export from Pages), but I just avoid apps like Pages if I need a finer level of output control.

  • Printing odd and even pages separately (manual duplex)

    Hi
    I searched the forum and found some similar problems regarding Adobe Reader 8.1.2 : Adobe Reader 8.1.2 doesn't print odd and even pages correctly
    This was posted more than a year ago. A few days ago I encountered the same problem with Adobe Acrobat 8.1.2. I suspected that it could be beacause of outdated software. I then applied incremental patches up to 8.1.5. But the problem still persists.

    The link was about Reader, but I tried it with AA8.1.5 on a 3 page document and did indeed find the same problem. The 1st page printed out, but the 3rd page was missing when printing the odd pages. When printing the even pages, the 2nd page printed out 2 times. The 3rd page never showed up. I think this is what you are talking about. Wonder if they fixed it in AA9?

  • Is it possible to have different margin settings for odd and even pages?

    Hi guys.
    I am formatting a book I want to get printed and it would be very helpful to have different margin settings on the odd and even pages so the text won't fall too close to the gutter (as happened in the proof copy I ordered!).
    It's possible to do this on Word, but I can't seem to do it on Pages? Am I missing something?
    Any help would be greatly appreciated. Thank you

    Thanks Peter. I upgraded to Pages 5 a while back. I guess my next question is.....is there any way I can downgrade to Pages 09...anywhere I can still download it from?
    Seems a bit of a backward step, but needs must

  • Odds and evens

    Hi,
    How can i determine when a number is odd or even?.
    Rgds,
    Jose

    hi,
    Just divide by 2, and check the remainder.
    report ztest.
    data:
          rem type p decimals 2,
          val type i value 657.
    rem = ( val mod 2 ).
    if rem = 0.
      write:/ 'Even'.
    else.
      write:/ 'Odd'.
    endif.
    Hope this helps !!!
    Cheers
    Alfred

  • Odd and even pages

    Hello all, Need some help on the xdp that I am working on.
    This xdp has 1 Page Set- set to Print on Both Sides.
    The first master page is the Odd Pages (Front pages).
    The second master page is the Even Pages (Back pages).
    There isn't much logic on the Even Pages as it is only static information.
    The content on the Odd (Front) pages flow and page number grow depending on the XML data I feed into it. I have explicitly set the content to flow through the content are of the Odd (Front) page only. Problem is, when the data breaks, it still puts a record or two on the content area of the Even (Back) page.
    Also, I was hoping that whenever there is an Odd (Front) page, I would assume that it would always have an Even (Back) page, but that is not the case. Sometimes the pages end out on the Odd Page.
    I would like to share the xdp along with the xml that I am working on to this posting. Is there a way to upload this information. Thanks in advance.

    Hi,
    The trouble is that when you have repeating objects they will continue in the container as new instances are added. When the page overflows, Acrobat/Reader is creating a new instance of the page, in which the new instances of the repeating object can be rendered.
    I had an example earlier that "jumped" a section, but in reality what it was doing was when the first page was full, it started to use a similar repeating instance on page3. Here it is, but you will need to have a close look at the script, as this was not annotated: https://acrobat.com/#d=0-YvJ8UcVW7Pyc4hhg3RmQ. It is a bit of a rough workaround, based on the height of the subform (see the click event of the add button on page1).
    You might also be able to get a conditional page break to work if the height of the rows was always the same.
    Hope that helps,
    Niall

  • Odd or even number comparison?

    Anyone know how to compare an incoming number and tell whether it is odd or even? How about if it is whole or fractional? Thanks
    Kirk

    fabb wrote:
    Anyone know how to compare an incoming number and tell whether it is odd or even? How about if it is whole or fractional? Thanks
    You need to be very careful applying odd/even to floating point numbers. It is only defined for intergers. Especially, if the value is a result of some computations, it could actually be 2.000000001 instead of 2.
    Same with whole vs. fractional. You probably need additional code to ignore small differences from whole numbers. Where does the data come from?
    ODD/EVEN: If you have an integer datatype, do a bitwise AND with "1" and check if the result is zero (even) or not (odd).
    Message Edited by altenbach on 05-27-2008 09:17 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    OddEven.png ‏3 KB

  • Odd or even number

    ok , basically how can I write a line of code which will tell me if a number is odd or even?

    the test for equality with 0 should work for all numbers - the remainder of dividing a negative number by two should be 0 or -1 (I think - and the code bears this out anyway)
    Lee

  • Odd and even rotating pages by file name

    Hi all,
    Hoping someone can help me trouble shoot my script below.
    The aim is to determined if the last two digits of the file name are odd or even and then rotate the file accordingly.
    I have been able to get the page rotation work by it's self but it seems to do nothing at all when trying to get the last two digits of the filename and use them as the variable "pgNum".
    Files will be named using the following convention....
    aa-02-02.pdf
    Thank you in advance for you help.
    =======================================================================================
    var re = /.*\/|\.pdf$/ig;
    var filename = this.path.replace(re,"");;
    var pgNum = filename.substring(-2);
    try {
        if(pgNum % 2) {
            var crtpagerotate = this.getPageRotation({nPage:i});
            this.setPageRotations({nStart: i, nEnd: i, nRotate:(270+crtpagerotate)%360});
        else {
            var crtpagerotate = this.getPageRotation({nPage:i});
            this.setPageRotations({nStart: i, nEnd: i, nRotate:(90+crtpagerotate)%360});
    catch (e)
        console.println("Batch Aborted: " + e )

    Try this:
    var re = /\.pdf$/i;
    var filename = this.documentFilename.replace(re, "");
    var pgNum = +filename.slice(-2);

  • Odd and even years with Time Windows?

    Hi All,
    Does anybody know how to implement a time window for even years / ode years?
    For example, a script A that needs to be executed every 1st January of even years and a script B that needs to be executed every 1st January of odd years.
    At last, it possible to :
    - specify hard coded dates in TW for these scripts,
    - use particular pre conditions (which script from A or B has to be executed) with a common yearly TW
    but better solutions are welcome
    Thanks a lot.
    Regards,
    Yi Jiang

    Hi Yi,
    If you need this for only one case, I'd go for the one-off setup of specific dates.
    If you have multiple cases, a simple way to achieve your goal is the following set of time windows:
    - TW_EVEN_YEARS: from 1-1-2010 to 31-12-2010, 1-1-2012 to 31-12-2012, 1-1-2014 to 31-12-2014, ...
    - TW_ODD_YEARS:  from 1-1-2009 to 31-12-2009, 1-1-2011 to 31-12-2011, 1-1-2013 to 31-12-2013, ...
    and then
    - TW_DAY1_EVEN_YEARS: day 1 enabled during TW_EVEN_YEARS
    - TW_DAY1_ODD_YEARS: day 1 enabled during TW_ODD_YEARS
    - TW_LAST_FRIDAY_EVEN_YEARS: last friday enabled during TW_EVEN_YEARS
    - TW_LAST_FRIDAY_ODD_YEARS: last friday enabled during TW_ODD_YEARS
    etc.
    This way, you do not need to specify the dates for each case, only once.
    Regards,
    Anton.

  • Selective combining between files with odd and even numbers of pages

    Hi all! First of all, i hope this is the right forum for my question. It has been asked before, but not fully answered. My problem is combining multiple pdfs with adding a blank page only to the ones that contain odd numbers of pages, the ones with even numbers should be left alone. I need a fast and automatic way of doing this so i can save huge amounts of time when faced with massive numbers of files. If this simply cannot be done, is there a way of sorting all the files so that, from the whole group, only the ones with odd numbers of pages go to a specified folder? Like this isnt enough i have the same problem when converting, lest say, multiple word files into 1 pdf file using pdf factory.
    Thanx in advance! also, any other way to go arround this problem is most welcome!
    Cheers!

    It would require knowledge of some JavaScript to determine if a particular page was landscape and if so, to rotate it. You could try asking in the JavaScript forum.

  • How to specify Master page depending on odd or even first page

    We've set up our books to delete empty pages and so that we have chapters starting on both odd and even pages. Also, the first pages of our chapters are formatted differently than the rest of the Left and Right Master pages. We would like to have two Master pages for the first page of the chapter, one for odd pages and the other for even, so that we can offset the margins, leaving a larger margin on the side towards the binding.
    My question is how do I set up the book so that when it generates, if the chapter starts on an odd page, it automatically applies the Master page for odd first pages and when the first page is even, it applies the Master page for even first pages?
    We have FramMaker 8 and are running it on Windows XP Professional.
    Thanks,
    Tim

    Assuming that you want this to happen automagically, I'd use the system default Right and Left Master pages as your chapter opener pages because Frame will apply those automatically depending on how the pages and chapters fall in the book. Then set up the internal chapter pages with whatever other structure you're using and apply those internal masters to the normal content that as you go.
    If you can't do that for some reason, I would look at doing it with a FrameScript that goes through the book and applies the alternating pages as a final production step.
    You could set up the first tag in the chapter to call a specific master page, but that would be manual and could quickly go south if any chapters ahead of a given chapter change the pagination. It would have to be manual because a given tag can only call one master page -- there isn't a way to apply logic to call one or the other depending on the situation.

Maybe you are looking for

  • How to create a movie file of java 3D animation without altering the code?

    Is there a way to create a movie file of a Java 3D animation without altering the source code of the Java 3D animation program??? Because as what I observed, most of the forum recommends extracting the bufferedimages of the animation. And, then using

  • Not able to use Aliph Jawbone 2.0

    T-Mobile recently replaced my Blackberry Curve 8320 using OS 4.2 with a Blackberry Curve using the new OS 4.5 I synced the Aliph Jawbone with it and when I make calls I am able to hear the other person on the line but they are not able to hear me at

  • Time Capsule with MacBook

    My problem is that my MacBook is registering 500kbps via time capsule and my 802.11g brand new Mac mini registers my supposed ISP speed of 2Mbps. Their setups are identical. I waited for 10.5.3 hoping it would sort out what was a general speed issue

  • How to get cwd of the current process in the kernel in Solaris 8

    Hi, everyone Does any one know how to get the path name of the current working directory of the current process in the kernel in Solaris8 ? I searched the forum and got some related links, but none of them gives a clear solution. Sample code can help

  • Excel for mac ver14.4.1 screen goes blank when i change to & from full screen view

    when i'm working on an excel document, if i am in full screen and hit escape to go non full screen the document goes blank. if i hit the full screen arrows again, i see my document momentarily and then the screen goes blank again. i believe this issu