Last active
August 29, 2015 14:16
-
-
Save asterwolf/3474219f20a6e65581fb to your computer and use it in GitHub Desktop.
COMP B11 - Lab4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This program reads a line of input that is stored as a string. It then removes | |
* one character from the string until there are no more characters remaining. | |
* @author Diego Diaz | |
* Course: COMPB11 | |
* Created: March 08, 2015 | |
* Source File : CharacterCountdown.java | |
* | |
*/ | |
import java.util.Scanner; | |
public class CharacterCountdown{ | |
public static void main(String[] args){ | |
Scanner input = new Scanner(System.in); | |
int index = 0; | |
String line; | |
String newWord; | |
System.out.print("Enter line:"); | |
line = input.nextLine(); | |
int lineLength = line.length(); | |
while (index < lineLength){ | |
newWord = line.substring(0, lineLength-index); | |
System.out.printf("%s\n",newWord); | |
index++; | |
} | |
input.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment