Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int fact(int n)
- {
- int s=0;
- while(n)
- {s=s+n%10;
- n=n/10;}
- return s;
- }
- int suma(int n)
- {
- if(n==0)
- return 0;
- else
- return suma(n/10)+n%10;
- }
- int ogl(int n)
- {
- ok=0;
- while(n)
- {
- ok=ok*10+n%10;
- n=n/10;
- }
- return ok;
- }
- int main()
- {
- cout<<suma(3434);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement