Advertisement
yovkovbpfps

Nested LOOPS CODING

Apr 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Coding {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String inputNum = scanner.nextLine();
  8.  
  9. for (int i = inputNum.length() - 1; i >= 0; i--) {
  10. char currentDigit = inputNum.charAt(i);
  11. int currentDigitToNum = Integer.parseInt("" + currentDigit);
  12.  
  13. if (currentDigitToNum == 0){
  14. System.out.println("ZERO");
  15. continue;
  16. }
  17.  
  18. for (int n = 1; n <= currentDigitToNum; n++) {
  19. System.out.print((char) (currentDigitToNum + 33));
  20. }
  21. System.out.println();
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement