Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class HelloWorld{
  4.  
  5. public static int sum(int n) {
  6. int k = 0;
  7. for (int i=139;i<n;i++) {
  8. int y = i / 100 + i % 100/10 + i % 10;
  9. if (y%13==0){
  10. k+=1;
  11. }
  12. }
  13. return k;
  14. }
  15.  
  16. public static void main(String []args){
  17. Scanner in = new Scanner(System.in);
  18. int x = in.nextInt();
  19. System.out.println(sum(x));
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement