Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import java.util*;
  2.  
  3. public class Ticket{
  4. public static void main(String arg[]){
  5. Scanner sc = new Scanner(System.in);
  6. int tn = sc.nextInt();
  7. int a, b, c, d, e, f;
  8. a = tn / 1000000;
  9. b = tn / 100000 % 10;
  10. c = tn / 10000 % 10;
  11. d = tn / 1000 % 10;
  12. e = tn / 100 % 10;
  13. f = tn % 10;
  14. System.out.println (a + b + c + d + e + f);
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement