store the procedure to calculate LCM and gcd of the two number

Hello
Can someone please help me write this procedure


-to calculate LCM and gcd of the two number




Thank you
Madam.

Well, you want, because you did not explain what you mean by LCM and gcd, so it doesn't have such a function.

I assume you mean smallest common Multiple and more common denominator she mathematical terms.

GCD can be developed...

SQL> ed
Wrote file afiedt.buf

  1  create or replace function gcd(num1 in number, num2 in number) return number is
  2    v_n1 number := greatest(num1,num2);
  3    v_n2 number := least(num1,num2);
  4    v_r  number := -1;
  5    v_d  number := 0;
  6  begin
  7    loop
  8      exit when v_r = 0;
  9      v_r := v_n1 - (trunc(v_n1 / v_n2)*v_n2);
 10      v_d := v_n2;
 11      v_n1 := v_n2;
 12      v_n2 := v_r;
 13    end loop;
 14    return v_d;
 15* end;
SQL> /

Function created.

SQL> select gcd(60,40) from dual;

GCD(60,40)
----------
        20

SQL> select gcd(64,40) from dual;

GCD(64,40)
----------
         8

SQL>

Why not have a go at LCM yourself...

http://www.idomaths.com/hcflcm.php

Tags: Database

Similar Questions

  • Y at - it an easy way to have a version number that the code VI has access to, and which is used as the version number for the executable file and the installer builds?

    Y at - it an easy way to have a version number that the code VI has access to, and which is used as the version number for the executable file and the installer builds? Now whenever I update my software I need to change the global variable where I store the version number, and then when I build I have in hand, open the properties and change the version number for the executable file and the installer. Is there an easy way to make these as all corresponding automatically?

    Have you tried a search? This question comes up a LOT. Here are the results of a search: http://forums.ni.com/t5/forums/searchpage/tab/message?location=Node%3A170&q=application+version#mess...

  • How to show the two original and change the line

    I have a table looks to and it store the two original and change lines, how can I get the Original lines both edit? In this case, I want to display the first two lines (all columns are composite keys)

    In the meantime, I use more Partition BY with line number, but I get a line

    flag

    APPNO

    EXAM

    TYPE

    EXAM

    YEAR

    EXAM

    MONTH

    Object

    Origin

    1234567890

    HL

    2015

    01

    Art and Design

    Edit

    HL

    2015

    01

    Art and Design

    origin

    SL

    2015

    01

    Math

    New

    SD

    2015

    01

    English

    Please check this one, I think it can meet your needs.

    SQL> with meta_data (flag,APPNO,EXAM_TYPE ,EXAM_YEAR ,EXAM_MONTH,SUBJECT)
      2          as (select 'Origin',1234567890,'HL',2015,01,'Art and Design' from dual union all
      3                  select 'Edit',1234567890,'HL',2015,01,'Art and Design' from dual union all
      4                  select 'origin',1234567890,'HL',2015,01,'Math' from dual union all
      5                  select 'New',1234567890,'HL',2015,01,'English' from dual )
      6  select *
      7    from meta_data
      8  where exists ( select 1
      9                             from meta_data outer
    10                           where flag ='Edit'
    11                              and meta_data.APPNO          =outer.APPNO
    12                              and meta_data.EXAM_TYPE          =outer.EXAM_TYPE
    13                              and meta_data.EXAM_YEAR          =outer.EXAM_YEAR
    14                              and meta_data.EXAM_MONTH          =outer.EXAM_MONTH
    15                              and meta_data.SUBJECT          =outer.SUBJECT)
    16  /
    
    FLAG        APPNO EX  EXAM_YEAR EXAM_MONTH SUBJECT
    ------ ---------- -- ---------- ---------- --------------
    Edit   1234567890 HL       2015          1 Art and Design
    Origin 1234567890 HL       2015          1 Art and Design
    
    SQL>
    
  • write/read the serial number of 32-bit

    Hello

    I want to read and display the number of 32-bit Seraglio and then want to store in a text file. every time I scan the new serial number, whenever it needs to store the new number.

    What exactly is the problem you are having? The task is very simple and has been discussed before. If you use a bar code scanner, just search the forum which. If you post the code you've written, a person could look and see what the problem is (if in fact you describe the problem).

    And in case you've not seen it before, there are tutorials available.

  • How to get the total number of pages have been printed using the pl/sql

    Dear all,

    I want to store the total number of physical pages printed in a database table, how could retrieve the value of the total number of pages.


    I am using Oracle 6i report

    thnxxx in advance :)

    At the end of your report (i.e. After all the images from your data model), place a dummy field. You can get the page number with srw.get_page_num in the trigger of the format of this field. Since it is the last field of your report, it is also the last page number.

  • Store the value less than the current week and the year.

    Hi all

    I have a table called BACK, which structure is like this
    ITEM_NUMBER   YEAR_WEEK   MS
    ...........   .........   ..
    1N58          2012-WK02   01/15/2012
    1N58          2011-WK02   01/15/2011
    current my procedure I store the value in my new table that is less than the current week. But I want to retain the value less than the current week and the current year. Please, help me to get how I can do this.
    PROCEDURE BACKLOG_PROC_LT_CW IS
      BEGIN
     DELETE BACKLOG_LT_CW;
     COMMIT;
          INSERT INTO BACKLOG_LT_CW
            SELECT 
                  DC_UTIL.GEN_YEAR_WEEK(MS) YEAR_WEEK,
                  ITEM_NUMBER,
                  MSD
    
                  FROM BACKLOG
              where to_char(MS, 'IW')<to_char(sysdate, 'IW');
    
      END BACKLOG_PROC_LT_CW;
    Currently, with the above code is to store the value in my table of BACKLOG_LT_CW but if you see the data in the table from the BACK you will find YEAR_WEEk 2012-WK02 falls next year, but again it is store in my table because IW took only. Please help me get the soln

    Thanks in advance

    Concerning

    Are you looking for this?

    ...
    where to_char(MS, 'YYYYIW')
    
  • Can I include a signature hosted on a remote server, create the signature in Tunderbird and store the file locally?

    I want to insert a signature that I hosted on a web server without having to create and save the local html file on my computer, is it possible? I know that I can insert a picture from a web server as part of my signature, which is not what I'm asking. Is there an add-on or anything else that can help me to insert my signature from a web server directly, without having to host the file locally?

    You do not have to store the signature on your computer, but Thunderbird will not bind to a text or HTML signature on a remote server file.

    Thunderbird is waiting for you to provide a simple signature to provide the URL to the 'IMAGE' stored on the remote server and this link should be included in Thunderbird, if not how to be referenced in the message?

    You can always include a link to the text that is stored remotely or a HTML signature in your message, but the recipient will activate it? Once again this link would be stored in the message

    TB - 38, 3 Win10-PC

  • synchronization: How can I store the mails for different accounts remotely and manually copy the most important e-mails in local folders on both devices?

    Hello. I have two machines and two accounts, so what I want is this:
    I want only to store mail from two accounts in a remote place and copy more important mails to local folders.

             (I will be grateful for any ideas as to where/how this "cloud" can be - specially free places)
             * Can I have a copy of these local folders in both devices and the remote storage?
             * Could i synchronize devices so that: when i move a mail to a local folder in any device, its copied to the same folders in
                the other device and the remote storage place?
             * The remote storage place will have many other folders. When I open Thunderbird, I also want to see these and the mail
                inside, and also be able to move mail from the inbox to these folders.
              * One of the accounts is gmail. In Account Setting tool, there is an option for synchronization. If there is no easier way, I can have mail for other account copied to gmail, and just syncronize gmail mail. For this, how will I copy my present folder structure to gmail. And how can I syncronize the local folders on the two devices?
    

    Thanks in advance.

    The first awkwardness that I see is that there is no clear format in which to store the messages remotely such that you can work with them in an email client. It may be possible to set the option "Local Directory" of the account in Thunderbird to point to a remote folder (DropBox comes to mind) but I've never tried, and I'd be nervous about what happens if the connection cannot be established, or if you happened to access it simultaneously from two different locations. The other concern is that mail stores are fast becoming big, and you would be forever download and download large files (several gigabytes). Thunderbird stores what looks like a folder that contains many messages separated as one big file, so there is no simple possibility of incremental changes to load up/down.

    The idea of local folders in Thunderbird is to detach messages from servers, therefore they do not follow what is happening on the servers. I say this to emphasize the distinction between files stored locally and permanently ("Local Folders"), against copies cached files online ("synchronized"). It is not sure to consider your folders synchronized as permanent.

    So folders synchronized on an IMAP server are "mirrored" in Thunderbird you do not have a local (although temporary and transitional) copy of messages. This is done primarily to avoid download repeatedly the messages if you re-read, and it makes the fastest search more effective. But these "synchronized" track of message that are deployed on the server, and so if they are deleted from anywhere, all devices that are synchronized at one point also see messages deleted endangered. (Except if you have saved a local copy on the local folders account).

    I use a gmail account quite as much as you described; Copy or move messages to this account, so that they are visible in my phone, my tablet, my own laptop and my computer works. It's free, and it is "in the cloud"; the only reservation I have is her private life. There are other suppliers (e.g. 1 & 1/gmx) who do not seem to have the fetish of collecting data that google thrives.

    It's pretty simple to create filters in Thunderbird to automatically copy messages to your account "cloud." even better is to implement the translation of rules on the servers of other accounts, to ensure that your messages are automatically sent and waiting for you when you log in next time, already in the cloud account.

  • I am not able to download apps for my iPhone on the App Store. He just 'waiting '. But never starts the download. I tried with wifi and mobile data. The two are not download apps

    I am not able to download apps for my iPhone on the App Store. He just 'waiting '. But never starts the download. I tried with wifi and mobile data. The two are not downloading the applications Can u find out what's wrong? I use iPhone 5s

    I had the same problem. At the same time hold the screen lock button and the home button until your iPhone restarts. That solved the problem for me.

  • Camcorder Camileo P100 store the date and time

    My recently purchased camcorder camileo P100 store the date and time.
    Whenever it starts it must be reset because it refers to the default date.

    Has anyone else had this problem

    It looks like a camera malfunction don t think you can fix it.
    I suggest you to get in touch with the dealer and replace the cam

  • Hello! If I icloud library disabled, will be always saved pictures? I know that your backup stores the photo library of all devices and because I'm not all devices to be synchronized I think I'm safe and won't lose my pictures/videos. Right?

    Hello! If I icloud library disabled, will be always saved pictures? I know that your backup stores the photo library of all devices and because I'm not all devices to be synchronized I think I'm safe and won't lose my pictures/videos. Can someone please clarify?

    If you want your photos backed up, you must import them into the photos on the computer application that synchronize you with. iCloud photo library is a repository for all the photos for a given iCloud ID. However, it is not required for the care of your photos. I do not use iCloud photo library - import my photos into the library of Photos on my Mac.

    A backup of your device iCloud will save your current film, but if you remove anything from this film, then it will not be available for retrieval at a later date, because backups replace the previous backup version. A backup is so not an archive safe for your photos or videos.

    Photo stream keeps the last 30 days or 1000 photos taken with your camera if you have Photo Stream on, but once again, it's a temporary storage that gets crushed. Photo stream is intended to provide a method of sharing photos between the signed devices on the same iCloud account, but is not intended as an archive.

    Import your pictures and videos on a computer means that all photos and videos are kept in a library on your computer and will be accessible. It is the only safe way to archive your photos:

    PHOTO IMPORT IOS ON MAC/PC

    Good luck

    GB

  • How to store the original and to remove some duplicate songs in iTunes on a PC Win7, which took place after iTunes to scan for music during a re - install?

    How to store the original and to remove some duplicate songs in iTunes on a PC Win7, which took place after iTunes to scan for music during a re - install?

    I recently had to format my hard drive and reinstall iTunes 12.3.2.35 on my Win7 PC. As part of the re - install iTunes, I clicked on the button scan for music.  This has created duplicates several of my songs.  I deleted then the duplicate songs from iTunes, but when I went to play a few songs a pop-up said "the song would not be because the original could not be found.  You want to locate? "When I tried to locate the song it is not found, but when I pulled the songs out of the trash they could be found.

    How can I keep the original and remove any duplicate songs in iTunes on PC Win7 which took place after iTunes to scan for music during a re - install?

    iTunes can create duplicates if the same content is added several times from outside the media folder when it is about to make copies of everything that is added to the library, or is added from an external drive that hosts the press kit that was disconnected during the launch of iTunes.

    Official notice of Apple on the duplicates is here: find and remove duplicates in your iTunes library. This is a manual process and article fails to explain some of the potential pitfalls such as the lost coast and membership of playlist, or sometimes the same file can be represented by multiple entries in the library as well as a removal and recycling the file will break all the others.

    Use MAJ > display > show items to reproduce exactly to display the duplicates because it is normally a selection more useful. You must manually select all but one of each group to remove. Sort the list by Date added can make easier select appropriate tracks, but it works better when executed immediately after the dupes were created.  If you have several entries in iTunes connected to a same file on the disk hard then don't not send to trash.

    Use my DeDuper script (Windows only) If you are not sure, do not want to do it by hand, or want to maintain ratings, play counts and playlist membership. See this background thread , this post for detailed instructions and Please take note of the warning to back up your library before deduping.

    (If you don't see the menu bar press ALT to temporarily view or CTRL + B to keep displayed.)

    The latest version of the script can put away the dead links as long as there is at least a double live to merge his stats and membership of the playlist and must deal wisely when the same file has been added through multiple paths.

    TT2

  • I recently had to replace my iPhone 6.  I can't store contact information, such as names and phone numbers.  I enter all the information and click Save.  Then go back and contact is not there

    I can't store the information under telephone contacts.  I enter information and press on save, but go back and contact is not there

    Is - this with iOS 5.0.1 and 4 s?

  • How to acquire and store the values of DAQmx analog voltage (I do not want the graphic, but strings and values in a chart)?

    Hello

    How acquire and store the values of voltage DAQmx?

    I tried several code example, but they can't get the chart. I don't want to chart. I want to measure exactly the analog voltage values and record these values - as an excel chart, that contains the selected channels and voltage values.

    What the example code that I can use?

    My hardware is NI PCI-6251.

    Thank you very much.


  • Download picture of URL link and store the Image in a Local folder in BB10 Webworks

    Hello

    I want to download the image of URL link and store the image in a local folder in Webworks BB10.
    But I did not get the code for this.

    If such knowledge code or have any solution then please help me...

    Thank you best regards &,.

    Laurent Subudhi

    NitishSubudhi wrote:
    I go through this code... but it is throwing the exception. That is to say "ReferenceError: Webworks is undefined '." "

    According to the device/operating system, you need to add the extension of your installation of WebWorks as explained here for OS SmartPhone BB or PlayBook OS.

    To use read the samples provided, they must work somehow. When I worked with the extension on PlayBook I only copy + pasted the provided source code and changed the attributes for the function call:

    // You need to define "remotePath", "localPath", "onProgress", "onError", "options" like shown in documentationblackberry.io.fileTransfer.downloadFile(remotePath, localPath, onProgress, onError, options);
    

    For OS SmartPhone BB the function call looks like this:

    // You need to define "options" like shown in documentationwebworks.io.FileDownloader.download(options);
    

    All think that all information provide here, try to follow and cela should operate.

Maybe you are looking for

  • Google Chrome

    So I was unable to open a page for a university interested. I had to download another browser besides Safari, so the one I trust is Chrome. Have someone at - he had problems with Chrome on their iMac? If so what are the problems? I love Safari and wi

  • I can't delete a game called Float that gives the message waiting. The cross and the oscillation with delete option appear, but it won't when I select Remove. Any ideas please?

    I have a new mini iPad 4. I can't delete a game called Float that gives the message waiting. The cross and the oscillation with delete option appear, but it won't when I select Remove. I don't know how it came to be. Any ideas please? Thank you.

  • iOS 9.3 and iPhone 5 c/s

    When I try to update my iPhone 5 c and 5 s to 9.3, I get a message that the update cannot be verified because I am not connected to the Internet (although I am).  After reading these comments on 9.3, I think that maybe it's a good thing.  I guess tha

  • I have to cancel my subscription to WSJ

    Hi I was accidentally subscribed to the Wall Street Journal. and have been charged with 16.99 for 2 months I tried to cancel the subscription for I tried to contact WSL to cancel they said I should contact you Help, please

  • LR RPC IS UNAVAILABLE

    I have diferent problems with my pc not the message which sort an Every wants entered in internet explore or Skype and the I change the photo of my desk or uninstalling the programs this famous message is "THE CPP is not available please I want help