Advertisement
tnkv

Untitled

Nov 19th, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. public class NumberDigits {
  2. public static int sumOfThirteen(int a) {
  3. int temp, tn = 0, colv = 0;
  4. for (int i = 0; i <= a; i++) {
  5. tn = i;
  6. temp = 0;
  7. while (tn >= 1) {
  8. temp += tn % 10;
  9. tn /= 10;
  10. }
  11. if (temp == 13) {
  12. System.out.println(i);
  13. colv++;
  14. }
  15. }
  16. return colv;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement