Question: NO LOOPS OR DECISION STATEMENTS!!! Write a JAVA program that reads any string of length 5 and prints all substrings of the string. Your program
NO LOOPS OR DECISION STATEMENTS!!! Write a JAVA program that reads any string of length 5 and prints all substrings of the string. Your program should contain FIFTEEN output statements which build the substrings and output the result. For example if abcde is entered by the user for the string, your program should build all FIFTEEN substrings and print them in this order:
a
ab
abc
abcd
abcde
b
bc
bcd
bcde
c
cd
cde
d
de
e
Next, your program will also read any integer of 5 digits and print all sub-numbers of the integer. For example if 12345 is entered as input, your program should build all 15 numbers and print them in this order:
1
12
123
1234
12345
2
23
234
2345
3
34
345
4
45
5
Note: You are NOT allowed to convert the integer input to a string in this second part of the program. You must work with it as an integer to generate your output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
