Advertisement
Kancho

Game_of_Words_and_Numbers

Feb 20th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Nested_Loops {
  4. public static void main(String[] args) {
  5.  
  6. Scanner key = new Scanner(System.in);
  7. System.out.print("Number: ");
  8. int num = Integer.parseInt(key.nextLine());
  9. String numToString = num + "";
  10. int digitsOfNum = numToString.length();
  11. System.out.println(digitsOfNum);
  12. for (int i = 0; i < digitsOfNum ; i++) {
  13. System.out.print("Word: " );
  14. String word = key.nextLine();
  15. System.out.println(word.length());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement