Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. int feliz(int n){
  2. int s,naux;
  3. naux=n;
  4. do
  5. {
  6. s=0;
  7. while (n!=0)
  8. {
  9. s=s+ n%10 * n%10;
  10. n=n/10;
  11. }
  12. n=s;
  13. }while(n>=10);
  14. {
  15. if(n==1)
  16. return 1;//Es feliz
  17. else
  18. return 0;//No es feliz
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement