Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class comp9 {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. int num, cont, aux;
  8. Scanner sc = new Scanner(System.in);
  9. System.out.println("Introduce el número");
  10. cont = 0;
  11. num = sc.nextInt();
  12. aux = num;
  13.  
  14. while (num >0) {
  15.  
  16. num = num/10;
  17. cont++;
  18. }
  19. System.out.println(aux+" tiene "+cont+" cifras");
  20. System.out.println("Introduce un número");
  21. num = sc.nextInt();
  22. sc.close();
  23. }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement