Exforsys
+ Reply to Thread
Results 1 to 2 of 2

please give logic of this program

This is a discussion on please give logic of this program within the C and C++ forums, part of the Programming Talk category; Write recursive function for this program , Delete FIRST digit , Input 4523 Output 523 ?...

  1. #1
    AMAR.BOGARI is offline Junior Member Array
    Join Date
    Jul 2009
    Answers
    1

    please give logic of this program

    Write recursive function for this program ,
    Delete FIRST digit , Input 4523 Output 523 ?

    Last edited by AMAR.BOGARI; 07-15-2009 at 11:38 AM.

  2. #2
    galileopy is offline Banned Array
    Join Date
    Sep 2009
    Answers
    2

    Using recursion and int

    If it allows you to use ints... it is pretty simple to do...

    Code:
    int deletefirst(int n)
    { 
             int temp;
             if (n<10) return 0; // delete the first digit
             else 
             {
                      temp=n%10;// save the last digit
                      n=n/10;//changes n
                      return delete(n)*10+temp;// goes until n<10 and then rebuilds the number
              }
    }



Latest Article

Network Security Risk Assessment and Measurement

Read More...