Friday, 26.04.2024, 13:22
Welcome Guest | RSS
Site menu
Login form
Section categories
Search
Calendar
«  June 2011  »
SuMoTuWeThFrSa
   1234
567891011
12131415161718
19202122232425
2627282930
Entries archive
Our poll
Rate my site
Total of answers: 6
Statistics

Total online: 1
Guests: 1
Users: 0

Main » 2011 » June » 10 » Number reverse by recurcive function
17:45
Number reverse by recurcive function
#include <iostream>

using namespace std;

int shrjum(int tiv) {
    int n=1, t = tiv;
    while ((t/10)!=0) {
        t/=10; n *=10;
        }
    if (tiv>=10)
    return (n*(tiv%10)) + shrjum(tiv/10);
    else
    return (tiv%10);
    }

int main(){
    int x;
    cin>>x;
    cout<<shrjum(x);
    return 0;
}

Category: C++ programs | Views: 520 | Added by: H_Imirzyan | Tags: recursive, function, Number, by, reverse | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *: