Advertisement
Guest User

P2

a guest
Mar 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int primacifra ( int n)
  4. {
  5. if(n<=9)
  6. return n;
  7. else
  8. return primacifra(n/10);
  9. }
  10. int main()
  11. {
  12. int n;
  13. cin>>n;
  14. cout<< primacifra(n);
  15. return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement