Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Nested_Loops {
- public static void main(String[] args) {
- Scanner key = new Scanner(System.in);
- System.out.print("Number: ");
- int num = Integer.parseInt(key.nextLine());
- String numToString = num + "";
- int digitsOfNum = numToString.length();
- System.out.println(digitsOfNum);
- for (int i = 0; i < digitsOfNum ; i++) {
- System.out.print("Word: " );
- String word = key.nextLine();
- System.out.println(word.length());
Advertisement
Add Comment
Please, Sign In to add comment