Exforsys

Free Training

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 ?...

Go Back   Exforsys > Programming Talk > C and C++

Exforsys.com


C and C++ C and C++

Reply

 

LinkBack Thread Tools Search this Thread
  #1 (permalink)  
Old 07-15-2009, 12:28 PM
Junior Member
 
Join Date: Jul 2009
Posts: 1
AMAR.BOGARI is on a distinguished road
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 12:38 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-29-2009, 08:26 PM
Banned
 
Join Date: Sep 2009
Posts: 4
galileopy is on a distinguished road
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
          }
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
comp.lang.c Answers (Abridged) to Frequently Asked Questions (FAQ) Steve Summit Tech FAQ 0 06-15-2004 07:00 AM
comp.lang.c Answers (Abridged) to Frequently Asked Questions (FAQ) Steve Summit Tech FAQ 0 06-01-2004 07:01 AM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit Tech FAQ 0 06-01-2004 07:00 AM
comp.lang.c Answers (Abridged) to Frequently Asked Questions (FAQ) Steve Summit Tech FAQ 0 05-15-2004 07:00 AM
Apple II Csa2 FAQs: Telecom Hardware & Transfers, Part 20/25 rubywand@swbell.net Tech FAQ 0 04-04-2004 08:29 AM


All times are GMT -4. The time now is 08:04 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
Copyright 2004 - 2009 Exforsys Inc. All rights reserved.