Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n , num , soma ;
- soma = 0 ;
- printf ("Insira um número? ") ;
- scanf ("%d" , &num) ;
- while (num > 0)
- {
- n = num % 10 ;
- num = num / 10 ;
- soma += n ;
- }
- printf ("A soma dos dígitos é %d.\n" , soma) ;
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment